I was implementing a lazy infinite Fibonacci sequence as an exercise, and it wasn't working. I remembered that I had seen a working example somewhere, Googled it, and up it came. And it works, but mine, while similar (and I've modified the two versions to make them even more similar except for the problem)...mine fails:
;; works: (take 7 fib-seq1) => (1 1 2 3 5) (def fib-seq1 ((fn rfib [a b] (lazy-seq (cons a (rfib b (+ a b))))) 1 1)) ;; fails: (take 7 fib-seq2) => IllegalArgumentException: Don't know how to create ISeq from: user$fib_seq2 (defn fib-seq2 ([] (fib-seq2 1 1)) ([a b] (lazy-seq (cons a (fib-seq2 b (+ a b)))))) Any clue as to why the second version fails? (This is with with clojure "1.3.0") -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en