|
|
|
|
![]() ![]() |
May 20 2008, 04:14 PM
Post
#1
|
|
|
Newbie ![]() Group: Members Posts: 5 Joined: 20-May 08 Member No.: 62,415 |
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 Bool Possible &&& Possible = Possible Impossible &&& _ = Impossible _ &&& Impossible = Impossible _ &&& _ = Unknown (|||) :: Modal Bool -> Modal Bool -> Modal Bool Impossible ||| Impossible = Impossible Possible ||| _ = Possible _ ||| Possible = Possible _ ||| _ = Unknown not' :: Modal Bool -> Modal Bool not' (Possible) = Impossible not' (Impossible) = Possible not' Unknown = Unknown contains :: Eq a => [a]->a->Bool contains = flip elem perfectcomm :: Modal Bool perfectcomm = Unknown knowself :: Modal Bool knowself = Unknown allKnow :: Eq a => [a]->String->Modal Bool allKnow _ "" = Possible allKnow [] k = Impossible allKnow (x:[]) k = knowself allKnow (x:xs) k = comm x xs k &&& allKnow xs k where comm p ps k = if contains ps p then knowself else perfectcomm |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 12th October 2008 - 12:22 AM |