3 ms·
I'm learning Haskell ATM and it looks similar to lazy lists in WHNF, as at each step you get an element and a "thunk" that can be used to compute the next step.
by draven 15y ago
I'm learning Haskell ATM and it looks similar to lazy lists in WHNF, as at each step you get an element and a "thunk" that can be used to compute the next step.
The code for the cycle Haskell function is really simple:
http://hackage.haskell.org/packages/archive/base/latest/doc/html/src/GHC-List.html#cycle http://hackage.haskell.org/packages/archive/base/latest/doc/...
- eridius 15y agoThis is similar to one of my favorite Haskell "tricks": Tying the Knot. It's kind of a mindfuck the first time you do it, but it also feels really really cool. http://www.haskell.org/haskellwiki/Tying_the_Knot http://www.haskell.org/haskellwiki/Tying_the_Knot