Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Clojure Infinite sequence example
(defn lista
([] (lista 1))
([one] (lazy-seq (cons one (lista (+ one 1))))))
(defn fibo
([] (fibo 0 1))
([one two] (lazy-seq (cons one (fibo two (+ one two ))))))
(defn -main
[& args]
(println (take 10 (lista)))
(println (take 10 (fibo))))
(-main)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment