[Haskell-cafe] Knowledge
jlw501
jlw501 at cs.york.ac.uk
Wed Dec 19 17:02:09 EST 2007
Just to clarify, this is a little gag almost. It just demonstrates the
problem of understanding knowledge as discussed by philosophers. perfectcomm
is undefined as it is unknown if you can perfectly pass on your intention to
another person. Likewise, it is unknown if you can express your subconscious
mind in reason to yourself, hence knowself being undefined. The function
then just slots these in on the cases of:
no one knowing it,
some knowing nothing,
no one knowing nothing,
one knowing it - I had to chuck that one in as a special case... it was
argued it was redundant, but the behavior changes without it, try setting
knowself to true, then allKnow [1,1] "a truth" ( equivalent in semantics to
allKnow [1] "a truth") should be true, but without that line it is false.
Can anyone explain?
and finally the important one (at least for those who are unfortunate enough
to work in KM), some knowing it.
Sorry, if I've messed with your heads, it's just I've been into Haskell for
a month and though I'd join (what seems to be) the forum and post something
quirky.
=)
Luke Palmer-2 wrote:
>
> On Dec 19, 2007 7:26 PM, jlw501 <jlw501 at cs.york.ac.uk> wrote:
>>
>> I'm new to functional programming and Haskell and I love its expressive
>> ability! I've been trying to formalize the following function for time.
>> Given people and a piece of information, can all people know the same
>> thing?
>> Anyway, this is just a bit of fun... but can anyone help me reduce it or
>> talk about strictness and junk as I'd like to make a blog on it?
>
> This looks like an encoding of some philosophical problem or something. I
> don't really follow. I'll comment anyway.
>
>> contains :: Eq a => [a]->a->Bool
>> contains [] e = False
>> contains (x:xs) e = if x==e then True else contains xs e
>
> contains = flip elem
>
>> perfectcomm :: Bool
>> perfectcomm = undefined
>> knowself :: Bool
>> knowself = undefined
>
> Why are these undefined?
>
>> allKnow :: Eq a => [a]->String->Bool
>> allKnow _ "" = True
>> allKnow [] k = False
>> allKnow (x:[]) k = knowself
>> allKnow (x:xs) k =
>> comm x xs k && allKnow xs k
>> where
>> comm p [] k = False
>
> This case will never be reached, because you match against (x:[]) first.
>
>> comm p ps k = if contains ps p then knowself
>> else perfectcomm
>
> And I don't understand the logic here. :-p
>
> Luke
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
--
View this message in context: http://www.nabble.com/Knowledge-tp14423007p14426329.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
More information about the Haskell-Cafe
mailing list