Skip to content

Instantly share code, notes, and snippets.

@unionx
Created December 3, 2012 22:19
Show Gist options
  • Select an option

  • Save unionx/4198654 to your computer and use it in GitHub Desktop.

Select an option

Save unionx/4198654 to your computer and use it in GitHub Desktop.

Revisions

  1. unionx created this gist Dec 3, 2012.
    7 changes: 7 additions & 0 deletions reduction1.clj
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    (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)))))))