« Return to Thread: Knowledge

Re: Knowledge

by jlw501 :: Rate this Message:

Reply to Author | View in Thread

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,
and finally the important one (at least for those who are unfortunate enough to work in KM), some knowing it.

Kudos for spotting the  redundant line, you are right, sorry I though you meant the allKnow (x:[]) was redundant.

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@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@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

 « Return to Thread: Knowledge