On Jun 14, 2008, at 6:14 PM, odtaa48 wrote:
hello
could someone explain the following differing results const id 0 5 -> 5 -- ie. 'takes' the 'last' one
const (id 0) 5 -> 0 -- ie. 'takes' the 'first' one

Thanks

You can easily see what is happening by rewriting the equations step by step. Remember that the const function is (\x y -> x) and the id function is (\x -> x).

Example 1:

   const id 0 5
== (const id 0) 5
== id 5
== 5

Example 2:

   const (id 0) 5
== const 0 5
== 0

So, in both cases const takes the first.

--
Sebastiaan.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to