Skip to content

Instantly share code, notes, and snippets.

@amalloy
Created July 9, 2011 23:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save amalloy/1074054 to your computer and use it in GitHub Desktop.
Save amalloy/1074054 to your computer and use it in GitHub Desktop.
def foo():
for x in [1..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