Skip to content

Instantly share code, notes, and snippets.

@mattdeboard
Forked from amalloy/gist:1074054
Created July 9, 2011 23:34
Show Gist options
  • Save mattdeboard/1074055 to your computer and use it in GitHub Desktop.
Save mattdeboard/1074055 to your computer and use it in GitHub Desktop.
def foo():
for x in range(5):
yield x
yield x*2
(letfn [(first [x]
(lazy-seq
(when (<= x 5)
(cons x (second x)))))
(second [x]
(lazy-seq
(cons (* 2 x)
(first (inc x)))))]
(first 1))
;; (1 2 2 4 3 6 4 8 5 10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment