Hacker News new | ask | show | jobs
by mark_h 6137 days ago
Clojure has lazy versions of most of the collections API (or possibly it defaults to laziness now, it has been a little while since I last played with it). They're implemented using macros of course, but they get you surprisingly far. I have a bit of a Haskell background, and was doing the Project Euler problems in Clojure frequently using the lazy stream processing idiom you just described.
1 comments

I think you need laziness to be a little more prevalent than that before it makes a difference. Haskell's super-concise Fibonacci sequence illustrates that:

  let fib = 1 : 1 : zipWith (+) fib (tail fib)
You may need to reevaluate what's possible in Clojure.

    (def fib (lazy-cat [1 1] (map + fib (rest fib))))
...Man, Clojure seems to have just about everything from every language ever.