Re: Haskell puzzles!

2002-03-21 Thread Rijk J. C. van Haaften
Zdenek Dvorak wrote: >>- >>1) Are e1 and e2 equal? >> >> > f (x:xs) y = x >> > g (x:xs)= \y -> x >> > >> > e1 = seq (f []) 1 >> > e2 = seq (g []) 1 > >Should not these be > >f (x:xs) y = y >g (x:xs)= \y -> y >? >Otherwise, both e1 and e

Re: Haskell puzzles!

2002-03-20 Thread Zdenek Dvorak
Hello. >- All the answers are at the end of this mail. > >- >1) Are e1 and e2 equal? > > > f (x:xs) y = x > > g (x:xs)= \y -> x > > > > e1 = seq (f []) 1 > > e2 = seq (g []) 1 Should not these be f (x:xs) y = y g (x:xs)= \y -> y ? Ot

Re: Haskell puzzles!

2002-03-19 Thread Jan-Willem Maessen
Daan Leijen writes: > 1) Are e1 and e2 equal? > > > f (x:xs) y = x > > g (x:xs)= \y -> x > > > > e1 = seq (f []) 1 > > e2 = seq (g []) 1 > ... > 1) > answer: > "e1" equals the value 1, while "e2" is undefined. > ... > opinion: > I think that the pattern matching translation rules > a

Haskell puzzles!

2002-03-19 Thread Daan Leijen
Hi all, I have put together some interesting Haskell puzzles! Not many people were able to solve all three puzzles so don't be discouraged you don't know all the answers. Have fun, Daan. - - All three puzzles are "Haske