std.lib.stream
add-transforms
added in 3.0
(add-transforms key xform & more)adds a transform to the list
(add-transforms :map x/x:map) => ’(:map)
atom-seq
added in 3.0
(atom-seq atm f)constructs an atom-seq
(take 5 (atom-seq (atom -1) inc)) => ’(0 1 2 3 4)
collect
added in 3.0
(collect sink supply)(collect sink xf supply)collection function given a seq supply
(collect [](range 5)) => 0 1 2 3 4
collect-collection
added in 3.0
(collect-collection sink xf supply)collect for java collections
(-> (collect-collection (java.util.ArrayList.) (map inc) (range 5))) => 1 2 3 4 5
collect-collector
added in 3.0
(collect-collector sink xf supply)collects values from seq given a collector
(collect-collector (Collectors/toList) (map inc) (range 5)) => 1 2 3 4 5
collect-ifn
added in 3.0
(collect-ifn f xf supply)collect outputs to a source
(-> (collect-ifn int-array (map inc) (range 5)) seq) => ’(1 2 3 4 5)
collect-nil
added in 3.0
(collect-nil _ xf supply)collect for nil
(collect-nil nil (map inc) (range 5)) => seq?
collect-promise
added in 3.0
(collect-promise sink xf supply)collects given a promise
@(doto (promise) (collect (map inc) (range 5))) => 1
collect-transient
added in 3.0
(collect-transient sink xf supply)collect for transients
(-> (collect-transient (transient []) (map inc) (range 5)) (persistent!)) => 1 2 3 4 5
collector
added in 3.0
(collector stages sink)creates a collection function
(collector :map inc []) => fn?
extend-stream
macro
added in 3.0
(extend-stream all)extends the stream protocol for a map of types
extend-stream-form
added in 3.0
(extend-stream-form [type {:keys [produce collect]}])extend protocols for a type
(extend-stream-form nil ’{:produce ’produce-nil :collect ’collect-nil})
gen:primitives
macro
added in 3.0
(gen:primitives)generate primitive forms
(produce (byte-array 5)) => ’(0 0 0 0 0)
object-seq
added in 3.0
(object-seq obj f)constructs an object-seq
(take 5 (object-seq (volatile! -1) #(vswap! % inc))) => ’(0 1 2 3 4)
pipe
added in 3.0
(pipe source stages sink)pipeline
added in 3.0
(pipeline stages)pipeline-transform
added in 3.0
(pipeline-transform stages)transforms a pipeline to transducer form
(pipeline-transform [:map inc :map inc :window 5]) => (contains fn? fn? fn?)
primitive-form
added in 3.0
(primitive-form [class {:keys [collect]}])creates the primitive forms
(primitive-form ’["Z" {:produce seq :collect collect-booleans})
produce
added in 3.0
(produce obj)produces a seq from an object
(produce (range 5)) => ’(0 1 2 3 4)
produce-callable
added in 3.0
(produce-callable f)produce for callable
(produce-callable (fn [] 1)) => ’(1)
produce-deref
added in 3.0
(produce-deref source)produces from a deref
(produce-deref (volatile! 1)) => ’(1)
produce-ifn
added in 3.0
(produce-ifn f)produce for functions
(produce-ifn (fn [] 1)) => ’(1)
(produce-ifn (fn [](range 5))) => ’(0 1 2 3 4)
produce-object
added in 3.0
(produce-object obj)default implementation of produce
(produce-object 1) => ’(1)
produce-stream
added in 3.0
(produce-stream source)produces values from a stream
(->> (to-stream (range 5)) (produce-stream) (map inc)) => ’(1 2 3 4 5)
produce-supplier
added in 3.0
(produce-supplier f)produce for supplier
(produce-supplier (fn/fn:supplier [] 1)) => 1
producer
added in 3.0
(producer source stages)creates a source seq
(producer (range 5) :map inc) => seq?
seqiter
added in 3.0
(seqiter coll)(seqiter xform coll)creates an non-chunking iterator from a transducer (sink)
(seqiter (map inc) (range 5)) => (range 1 6)
unit
added in 3.0
(unit input)(unit xform input)applies a transducer to single input
(unit (map inc) 1) => 2