Good point.
By fold/unfold transformation you get the following:
contains = flip elem [Eureka]
=
contains xs e = flip elem xs e [Expose data structures]
=
contains [] e = False
contains (x:xs) e = flip elem (x:xs) e [Instantiate]
=
contains [] e = False
contains (x:xs) e = elem e x:[] || flip
jlw501 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
On Dec 19, 2007 7:26 PM, jlw501 [EMAIL PROTECTED] 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
Hi
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
And even if not using the elem function, the expression:
if x==e then True else contains xs e
can be written as:
x==e || contains xs e
Thanks
Neil
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
The main observation I've made it when playing with the values of knowing the
self and perfect communication, nothing else becomes undefined if just
perfect communication is true, it is still depended on knowing the self if
you can have knowledge. Makes sense.
jlw501 wrote:
Just to clarify,