That is a nice fibonacci! I love Haskell because no matter how nicely I think I've seen a solution expressed there's always something neat I hadn't quite seen. In a similar vein, I like the example from the Clojure docs for lazy-seq:
;; A lazy-seq of Fibonacci numbers (fn = fn-1 + fn-2);; The producer function takes exactly two parameters;; (because we need the last 2 elements to produce a new one)user=>(defnfib([](fib11))([ab](lazy-seq(consa(fibb(+ab))))))user=>(take5(fib))(11235)
You don't really need to know Clojure much at all to read this and understand what it does.
That is a nice fibonacci! I love Haskell because no matter how nicely I think I've seen a solution expressed there's always something neat I hadn't quite seen. In a similar vein, I like the example from the Clojure docs for lazy-seq:
You don't really need to know Clojure much at all to read this and understand what it does.
I've yet to dabble in Clojure, but thanks for sharing!😁 You're right, it certainly is easier to understand without knowing the language