Skip to content

Instantly share code, notes, and snippets.

@mihneadb
Created October 11, 2014 19:17
Show Gist options
  • Save mihneadb/48d0751f62674928269d to your computer and use it in GitHub Desktop.
Save mihneadb/48d0751f62674928269d to your computer and use it in GitHub Desktop.
mapping transducer
(sequence (map inc) [1 2 3]) ; (2 3 4)
; ^^^^^^^^^
; "mapping transducer"
(defn sequence
; [...]
([xform coll]
(clojure.lang.LazyTransformer/create xform coll))
; [...]
)
; from the java source at https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LazyTransformer.java#L114
; this.xform = (IFn) xform.invoke(stepfn);
; ^^^^^^^^^^^
; transudcer getting stepfn as argument
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment