Skip to content

Instantly share code, notes, and snippets.

@unionx
Created December 3, 2012 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unionx/4198654 to your computer and use it in GitHub Desktop.
Save unionx/4198654 to your computer and use it in GitHub Desktop.
4clojure #60
(fn reduction1
([f col]
(reduction1 f (f (first col)) (rest col)))
([f val col]
(if (empty? col)
(list val)
(cons val (lazy-seq (reduction1 f (f val (first col)) (rest col)))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment