[Haskell-cafe] Re: Learning about Programming Languages
(specifically Haskell)
Samuel Williams
space.ship.traveller at gmail.com
Mon May 3 05:31:43 EDT 2010
Also, one more thing - if someone could write some comments to go along with the source code that explain what it is doing, that would be really helpful. I can see the general structure, but I don't know the ins and outs of Haskell. If someone could augment the example with comments explaining what the functions do that would be great!
data Door = Open | Closed deriving Show
toggle Open = Closed
toggle Closed = Open
pass k = zipWith ($) (cycle $ replicate k id ++ [toggle])
run n = foldl (flip pass) (replicate n Closed) [0..n]
Do I need to add run 100 to the end of the example for it to actually do something?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100503/d0bd3587/attachment.html
More information about the Haskell-Cafe
mailing list