Honesty Rocks! truth rules.

Philososphy Of Knowledge

HOME      >>       Programming


After working in KM for a year and dating a Communication undergraduate I have come to understand the intractabley complex problem of understanding the true nature of knowledge transfer (and women). Also, I have recently got into Haskell, which is a remarkabley expressive functional programming language in which I have demonstrated this problem. The first part is a fix for the strictness problem with logical conjunction and disjuncition. In certain cases, you wish these to be strict in the first argument to prevent program errors in statements such as if ((p!=NULL)&&(p->data==1)){...}. However, strictness like this is causes unwanted behaviour in my program. Contains is defined at the function level. How slick is Haskell! Following that is the assignment to unknown of two variables in our model, the ability to commuicate perfectly and the ability to understand ourselves fully. Finally, we have the function allKnow, which when passed a list of people and a string of information will tell you if all these people can know the information in the same way. A fairly useless piece of code, but interesting none the less.data Modal p = Possible | Impossible | Unknown deriving Show(&&&) :: Modal Bool -> Modal Bool -> Modal BoolPossible &&& Possible = PossibleImpossible &&& _ = Impossible_ &&& Impossible = Impossible_ &&& _ = Unknown(|||) :: Modal Bool -> Modal Bool -> Modal BoolImpossible ||| Impossible = ImpossiblePossible ||| _ = Possible_ ||| Possible = Possible_ ||| _ = Unknownnot' :: Modal Bool -> Modal Boolnot' (Possible) = Impossiblenot' (Impossible) = Possiblenot' Unknown = Unknown contains :: Eq a => [a]->a->Boolcontains = flip elemperfectcomm :: Modal Bool perfectcomm = Unknownknowself :: Modal Boolknowself = UnknownallKnow :: Eq a => [a]->String->Modal BoolallKnow _ "" = PossibleallKnow [] k = ImpossibleallKnow (x:[]) k = knowselfallKnow (x:xs) k = comm x xs k &&& allKnow xs k where comm p ps k = if contains ps p then knowself else perfectcomm