Skip to content

Comment on Ask HN: Could a Lisp be Blub?parent

Comments

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.

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.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.