[Haskell-cafe] How the following works

Tsunkiet Man temp.tsun at gmail.com
Tue Apr 14 04:39:28 EDT 2009


I can hardly imagine how the following code works:

cinits :: [a] -> [[a]]
cinits [] = [[]]
cinits (x:xs) = [] : map (x:) (cinits xs)

can someone give me a good explaination?

(I understand it a bit, but it's really hard for me to figure out how a map
in a map function works.)

Thank you for your time,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090414/2037f22b/attachment.htm

More information about the Haskell-Cafe mailing list