[Haskell-cafe] A function that makes list of Bool lists from list of Int lists

Maur Toter mauro19838 at gmail.com
Sat Apr 3 11:34:21 EDT 2010


Thanks again!

The last part I cant understand:
So I give it for example
zipWith ($) (map (\x -> map (const x)) (cycle [True, False])) [[1,2],[3]]

Okay, because of ($) it takes the first element of the last part which is
[1,2] and apply the function on it
But how makes this: map (\x -> map (const x)) (cycle [True, False])
[True,True] from [1,2]?
Then he takes [3] but how makes [False] from that?

It easily can be that my functional programming knowledge isn't enough to
understand this and maybe I misunderstood it already. But I hope I'll be
able to do so..

Thanks:
Maur Toter

so

On Sat, Apr 3, 2010 at 4:31 PM, Edward Z. Yang <ezyang at mit.edu> wrote:

> Excerpts from Maur Toter's message of Sat Apr 03 10:29:34 -0400 2010:
> > What does the ($) at zipWith?
>
> ($) is function application
>
> Prelude> :t ($)
> ($) :: (a -> b) -> a -> b
>
> Cheers,
> Edward
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100403/d0790f4a/attachment.html


More information about the Haskell-Cafe mailing list