Immutable, mutable and persistent collections. Reducers and transducers .

IAssociative

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with methods -entry, -assoc

extensions of this protocol on existing types are forbidden (performance and/or backwards compatibility reasons).

A value protocol for associative collections. For backwards compatibility with Clojure, implementations should also implement c.l.Associative/containsKey.

See also: associative?, assoc

-entry

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-entry this key)

Type signature:
  • (Any ⨯ Any) → Any

Returns the entry from this for a given key as a counted collection with key as a first item. Depending on a type, there may be a value as a second item, or they may be multiple values (multimap) present.

See also: IAssociative

-assoc

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-assoc this key val)

Type signature:
  • (Any ⨯ Any ⨯ Any) → IAssociative

assoc[iate]. Returns a new collection, that contains the mapping of key to val. For multimap, val must be a collection and this method replaces all previous vals with those in val.

See also: IAssociative

IBatchedRed

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -reduce-batched

A value protocol for batchable collections, which reduce in batches to optimize data processing. Note that reducing function reducef must accept batch instead of just one value. Batchable collections must also implement IHomogeneous.

-reduce-batched

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-reduce-batched this item-type size-hint reducef init)

Type signature:
  • (Any ⨯ (U nil Class+ Type) ⨯ (Maybe Integer+) ⨯ (Fn [Any Any AnyBatch]) ⨯ Any) → Any

Returns the reduction of sequence of batches with reducing function reducef and with a starting value init. Batch size may be hinted with size-hint. Batch must be of type item-type. If item-type is nil, collection uses its default type. May return postponed or reduced object. Implementations must correctly handle reduced and postponed references and care must be taken to correctly handle postponed results returned from underlying collection, if the implementation has one.

See also: IBatchedRed

ICapped

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -capacity

A value protocol for collections that have a capacity.

See also: capped?, capacity, brimming?

-capacity

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-capacity this)

Type signature:
  • (Any) → Integer+

Returns capacity of a given this.

See also: ICapped

ICatenable

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -cat

A value protocol for catenable collections.

See also: catenable?, cat

-cat

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-cat this other)

Type signature:
  • (Any ⨯ ICatenable) → ICatenable

Returns the catenation of this with other collection of same type. Resulting collection is of the same type as this. Operation must be faster than linear time and may share data with original collections.

See also: ICatenable

ICollectionFactory

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with methods -from-coll, -from-items

A factory protocol for collections.

-from-coll

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-from-coll this coll)

Type signature:
  • (Any ⨯ []) → IRed

Returns a new collection from the contents of collection this, which can also be nil.

See also: ICollectionFactory

-from-items

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-from-items this)

  • (-from-items this a)

  • (-from-items this a b)

  • (-from-items this a b c)

  • (-from-items this a b c d)

  • (-from-items this a b c d more)

Type signatures:
  • (Any) → IRed

  • (Any ⨯ Any) → IRed

  • (Any ⨯ Any ⨯ Any) → IRed

  • (Any ⨯ Any ⨯ Any ⨯ Any) → IRed

  • (Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any) → IRed

  • (Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any ⨯ IRed) → IRed

Returns a new collection that contains given items.

See also: ICollectionFactory

IConvolutionFactory

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with methods -convolute, -from-interleaved

Factory protocol for convoluted collections.

-convolute

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-convolute this c1 c2)

  • (-convolute this c1 c2 c3)

  • (-convolute this c1 c2 c3 c4)

  • (-convolute this c1 c2 c3 c4 more)

Type signatures:
  • (Any ⨯ IRed ⨯ IRed) → IRed

  • (Any ⨯ IRed ⨯ IRed ⨯ IRed) → IRed

  • (Any ⨯ IRed ⨯ IRed ⨯ IRed ⨯ IRed) → IRed

  • (Any ⨯ IRed ⨯ IRed ⨯ IRed ⨯ IRed ⨯ IRed) → IRed

Returns new collection which will contain convoluted contents from given collections. Factory is not required to support all arities.

-from-interleaved

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-from-interleaved this)

  • (-from-interleaved this a b)

  • (-from-interleaved this a b c)

  • (-from-interleaved this a b c d)

  • (-from-interleaved this a b c d e)

  • (-from-interleaved this a b c d e f)

  • (-from-interleaved this a b c d e f g)

  • (-from-interleaved this a b c d e f g h)

  • (-from-interleaved this a b c d e f g h more)

Type signatures:
  • (Any) → IRed

  • (Any ⨯ Any ⨯ Any) → IRed

  • (Any ⨯ Any ⨯ Any ⨯ Any) → IRed

  • (Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any) → IRed

  • (Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any) → IRed

  • (Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any) → IRed

  • (Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any) → IRed

  • (Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any) → IRed

  • (Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any) → IRed

Returns new collection from given interleaved pieces. Factory is not required to support all arities.

ICounted

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -count

A value protocol for counted collections.

-count

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-count this)

Type signature:
  • (Any) → Integer+

Returns the size of this, in constant time.

See also: ICounted

IEditable

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -edit

A value protocol for immutable collections that can be converted to mutable ones in a constant time. For backwards compatibility with Clojure, implementations should also implement one arg c.l.IEditableCollection/asTransient method.

See also: editable?, edit, settle!

-edit

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-edit this capacity-hint)

Type signature:
  • (Any ⨯ (Maybe Integer+)) → Any

Returns the mutable collection based on this. This operation must be (amortized) constant time if this is a persistent collection.

See also: IEditable

IEmptyAware

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -empty?

A value protocol for collections that can be empty.

See also: empty?

-empty?

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-empty? this)

Type signature:
  • (Any) → Boolean+

Returns true if this is nil or has no items.

See also: IEmptyAware

IEmptyable

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -empty

A value protocol for collections that can return their empty version.

See also: emptyable?, empty

-empty

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-empty this)

Type signature:
  • (Any) → IRed

Returns the empty collection of same category as this. Metadata must be preserved.

See also: IEmptyable

IFlippable

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -flip

A value protocol for flipable collections.

See also: flippable?, flip

-flip

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-flip this)

Type signature:
  • (Any) → IFlippable

Returns flipped collection from this, of same type.

See also: IFlippable

IFullAware

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -full?

A value protocol for collections which can be full.

See also: full-aware?, capped?

-full?

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-full? this)

Type signature:
  • (Any) → Boolean+

Returns true if this is full.

See also: IFullAware

IHomogeneous

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -item-type

A value protocol for homogeneous collections.

See also: homogeneous?, item-type

-item-type

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-item-type this)

Type signature:
  • (Any) → (U nil Class+ Type)

Returns type of items in this homogeneous collection. Returns nil if this can produce items of any requested type.

See also: IHomogeneous

IIndexed

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -nth

A value protocol for indexed collections. Indexed collections implement fast access to the nth item with integer index. For backwards compatibility with Clojure, implementations should also implement 2 args c.l.Indexed/nth method.

See also: indexed?, nth

-nth

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-nth this index not-found)

Type signature:
  • (Any ⨯ Integer+ ⨯ Any) → Any

Returns item at index position, or returns not-found if position is out of bounds.

See also: IIndexed

IInvertible

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -invert

A value protocol for invertible collections. Example of invertible collection is set or bimap.

See also: invertible?, invert

-invert

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-invert this)

Type signature:
  • (Any) → IInvertible

Returns inverted collection from this.

See also: IInvertible

ILookup

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with methods -contains?, -get

A value protocol for collections with lookup. Lookup collections implement fast access to their items based on a key. For backwards compatibility with Clojure, implementations should also implement both c.l.ILookup/valAt methods.

See also: lookup?, contains?, get

-contains?

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-contains? this key)

Type signature:
  • (Any ⨯ Any) → Boolean+

Returns true if this collection contains an entry with a given key.

See also: ILookup

-get

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-get this key not-found)

Type signature:
  • (Any ⨯ Any ⨯ Any) → Any

Returns value for a given key, or returns not-found if item is not found. Returns collection that implements ICounted, if there are multiple values for a given key (e.g. in multimaps or bags).

See also: ILookup

IMutableAssociative

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -assoc!

A mutable collection protocol for associative collections. For backwards compatibility with clojure, implementations may be needed to implement c.l.ITransientVector/assocN method.

See also: assoc!

-assoc!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-assoc! this key val)

Type signature:
  • (Any ⨯ Any ⨯ Any) → IMutableAssociative

assoc[iate]. Returns a new collection, that contains the mapping of key to val. For multimap, val must be a collection and this method replaces all previous vals with those in val. Mutates this.

IMutableBag

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -disj-all!

An abstract type mutable protocol for bags.

See also: disj-all!

-disj-all!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-disj-all! coll key)

Type signature:
  • (Any ⨯ Any) → IMutableBag

Returns this with all instances of key removed. Mutates this.

See also: IMutableBag

IMutableCatenable

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -cat!

A value protocol for mutable catenable collections.

See also: cat!

-cat!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-cat! this other)

Type signature:
  • (Any ⨯ IMutableCatenable) → IMutableCatenable

Returns the catenation of this with other collection of same type. Resulting collection is of the same type as this. Mutates this.

See also: IMutableCatenable

IMutableCollection

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -conj!

A collection protocol for mutable collections.

See also: conj!

-conj!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-conj! this x)

Type signature:
  • (Any ⨯ Any) → IMutableCollection

Returns the modified this with x conjoined. Original this will never be used again.

See also: IMutableCollection

IMutableMap

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -dissoc!

extensions of this protocol on existing types are forbidden (performance and/or backwards compatibility reasons).

An abstract type mutable protocol for maps.

See also: dissoc!

-dissoc!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-dissoc! this key)

Type signature:
  • (Any ⨯ Any) → IMutableMap

dissoc[iate]. Returns a new coll that does not contain any mapping for key. Mutates this.

See also: IMutableMap

IMutableMultiMap

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -dissoc-one!

An abstract type mutable protocol for multimaps.

See also: dissoc-one!

-dissoc-one!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-dissoc-one! this key val)

Type signature:
  • (Any ⨯ Any ⨯ Any) → IMutableMultiMap

dissoc[iate]. Returns a new coll that does not contain mapping specified by key and val. Mutates this.

See also: IMutableMultiMap

IMutableSet

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -disj!

extensions of this protocol on existing types are forbidden (performance and/or backwards compatibility reasons).

An abstract type mutable protocol for sets. For backwards compatibility with Clojure, implementations should also implement both c.l.ITransientSet/contains and c.l.ITransientSet/get.

See also: disj!

-disj!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-disj! this key)

Type signature:
  • (Any ⨯ Any) → IMutableSet

Returns the this with key removed. For bags, only one instance of key is removed. Mutates this.

See also: IMutableSet

IMutableStacked

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -pop!

A mutable collection protocol for stacked collections.

See also: pop!

-pop!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-pop! this)

Type signature:
  • (Any) → IMutableStacked

Returns this without one item at a position specified by the implementation. It may be the first item (Lists, Queues), or it may be the last item (Vector). Mutates this.

See also: IMutableStacked

IPeekable

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -peek

A value protocol for peekable collections.

See also: peekable?, peek

-peek

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-peek this)

Type signature:
  • (Any) → Any

Returns item from a collection at a position specified by the implementation. It may be the first item (Lists, Queues), or it may be the last item (Vector). Peeking an empty collection should return nil.

See also: IPeekable

IPersistentBag

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -disj-all

An abstract type value protocol for persistent bags.

See also: bag?, disj-all

-disj-all

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-disj-all this key)

Type signature:
  • (Any ⨯ Any) → IPersistentBag

Returns the this with all instances of key removed.

See also: IPersistentBag

IPersistentCollection

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -conj

extensions of this protocol on existing types are forbidden (performance and/or backwards compatibility reasons).

A value protocol for persistent collections.

See also: coll?, conj

-conj

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-conj coll x)

Type signature:
  • (Any ⨯ Any) → IPersistentCollection

Returns the this collection with x conjoined.

IPersistentList

Available since version 1.0 (view source)

not referred automatically

MARKER PROTOCOL

extensions of this protocol on existing types are forbidden (performance and/or backwards compatibility reasons).

Abstract type value protocol for persistent lists.

See also: list?

IPersistentMap

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -dissoc

extensions of this protocol on existing types are forbidden (performance and/or backwards compatibility reasons).

An abstract type value protocol for persistent maps.

See also: map?, dissoc

-dissoc

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-dissoc this key)

Type signature:
  • (Any ⨯ Any) → IPersistentMap

dissoc[iate]. Returns a new coll that does not contain any mapping for key.

See also: IPersistentMap

IPersistentMultiMap

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -dissoc-one

Abstract type value protocol for persistent multimaps.

See also: multimap?, dissoc-one

-dissoc-one

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-dissoc-one this key val)

Type signature:
  • (Any ⨯ Any ⨯ Any) → IPersistentMultiMap

dissoc[iate]. Returns a new coll that does not contain mapping specified by key and val.

IPersistentSet

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -disj

extensions of this protocol on existing types are forbidden (performance and/or backwards compatibility reasons).

An abstract type value protocol for persistent sets. For backwards compatibility with Clojure, implementations should also implement both c.l.IPersistentSet/contains and c.l.IPersistnetSet/get.

See also: set?, disj

-disj

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-disj this key)

Type signature:
  • (Any ⨯ Any) → IPersistentSet

Returns the this with key removed. For bags, only one instance of key is removed.

See also: IPersistentSet

IPersistentVector

Available since version 1.0 (view source)

not referred automatically

MARKER PROTOCOL

extensions of this protocol on existing types are forbidden (performance and/or backwards compatibility reasons).

Abstract type value protocol for persistent vectors. For backwards compatibility with clojure, implementations should also implement c.l.IPersistentVector/assocN and c.l.IPersistentVector/length.

See also: vector?

IRed

Available since version 1.0 (view source)

PROTOCOL with method -reduce

A value protocol for reducible collections.

-reduce

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-reduce this reducef init)

Type signature:
  • (Any ⨯ AnyFn ⨯ Any) → Any

Returns the reduction of this with a reducing function reducef and with a starting value init, or returns a postponed object, if the reduction was postponed either by the reducef or by the collection itself. May return reduced object. Implementations must correctly handle reduced and postponed references and care must be taken to correctly handle postponed results returned from the underlying collection, if the implementation has one.

See also: IRed

IReducing

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with methods -init, -finish, -wrap, -unwrap, -step, -combine

extensions of this protocol on existing types are forbidden (performance and/or backwards compatibility reasons).

A value protocol for augmented reducing functions.

-init

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-init this)

Type signature:
  • (Any) → Any

Returns default initial unwrapped value. May NOT return reduced or postponed object.

See also: IReducing

-finish

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-finish this wrap)

Type signature:
  • (Any ⨯ Any) → Any

Returns final unwrapped result, and performs flushing or cleaning of internal state. May return reduced or postponed object. Input is not postponed but may be reduced, which signals that finalization of early terminated reduction should be performed. Implementation should return reduced object at least when wrap is reduced.

See also: IReducing

-wrap

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-wrap this ret)

Type signature:
  • (Any ⨯ Any) → Any

Returns wrapped result ret. Initializes reducing state. May NOT return reduced or postponed object. Inputs are not reduced nor postponed.

See also: IReducing

-unwrap

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-unwrap this wrap)

Type signature:
  • (Any ⨯ Any) → Any

Returns unwrapped result ret. May NOT return reduced or postponed object. Inputs are not reduced nor postponed.

See also: IReducing

-step

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-step this wrap val)

  • (-step this wrap val val2)

  • (-step this wrap val val2 val3)

  • (-step this wrap val val2 val3 val4)

  • (-step this wrap val val2 val3 val4 more)

Type signatures:
  • (Any ⨯ Any ⨯ Any) → Any

  • (Any ⨯ Any ⨯ Any ⨯ Any) → Any

  • (Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any) → Any

  • (Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any) → Any

  • (Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any ⨯ Any ⨯ [Any]) → Any

Returns new wrapped result based on applying given input values to the wrap. May return reduced or postponed object. Inputs are not reduced nor postponed.

See also: IReducing

-combine

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-combine this wrap other)

Type signature:
  • (Any ⨯ Any ⨯ Any) → Any

Returns wrapped result combined from wrap and other. May NOT return reduced or postponed object. Inputs will not be finished and are not reduced nor postponed. May NOT return reduced or postponed object.

See also: IReducing

IReversible

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -reverse

Value protocol for reversible collections. For backwards compatibility with Clojure, implementations should also implement c.l.Reversible/rseq method, which returns reversed Seq.

See also: reversible?, reverse

-reverse

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-reverse this)

Type signature:
  • (Any) → IRed

Returns reversed collection from this in constant time. Does not preserve type, is at least a collection.

See also: IReversible

ISectionable

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -section

Value protocol for indexed sectionable collections.

See also: sectionable?, section

-section

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-section this begin end)

Type signature:
  • (Any ⨯ Integer+ ⨯ Integer+) → []

Returns new collection which is the result of sectioning this from begin inclusive into the end exclusive. nil in begin defaults to the first item and nil in the end defaults to the last item in this. Resulting coll will be of similar type and will share underlying data with this and thus will hold onto all original items. Operation is constant time though. Returned collection does not have to be persistent.

See also: ISectionable

ISeq

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -rest

extensions of this protocol on existing types are forbidden (performance and/or backwards compatibility reasons).

An abstract type value protocol for sequences. For backwards compatibility with Clojure, implementations should also implement c.l.ISeq/first and c.l.ISeq/next methods.

Note for implementers: If seq can be empty, it is important to check that calling seq on an empty seq object returns nil.

See also: seq?, rest

-rest

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-rest this)

Type signature:
  • (Any) → ISeq

Returns a possibly empty sequence without first item.

See also: ISeq

ISeqable

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -seq

extensions of this protocol on existing types are forbidden (performance and/or backwards compatibility reasons).

A value protocol for collections that can be transformed to seqs which are faster than ones created with a default IRed → ISeq transformation.

See also: seq

-seq

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-seq this)

Type signature:
  • (Any) → (Maybe ISeq)

Returns a seq representing this collection or nil, if this is empty.

See also: ISeqable

ISequential

Available since version 1.0 (view source)

not referred automatically

MARKER PROTOCOL

extensions of this protocol on existing types are forbidden (performance and/or backwards compatibility reasons).

A value protocol for sequential collections. Sequential collections are dunaj collections which main purpose is to serve as an ordered collection of items. This precludes e.g. String from being a sequential, as string’s main purpose is to convey a textual information.

See also: sequential?

ISettleable

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -settle!

A mutable collection protocol for settleable collections, a mutable collections that can be transformed into immutable or persistent variants.

See also: settleable?, settle!

-settle!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-settle! this)

Type signature:
  • (Any) → IRed

Returns the immutable (and preferably persistent) version of this. Any subsequent operations on original this should throw. This operation is (amortized) constant time only if resulting coll will be a persistent collection. (for other colls, there may be normalizing/trimming to size, …​)

See also: ISettleable

ISliceable

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -slice

Value protocol for sliceable collections.

See also: sliceable?, slice

-slice

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-slice this begin end)

Type signature:
  • (Any ⨯ Any ⨯ Any) → ISliceable

Returns new collection which is the result of slicing this from begin inclusive into the end exclusive. nil in begin defaults to the first item and nil in the end defaults to last item in this. Resulting coll will be of same type and will not hold onto items not belonging to it.

See also: ISliceable

ISnapshotable

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -snapshot!

A mutable collection protocol for snapshotable collections, a concurrent mutable collections that can provide immutable or persistent snapshot of its state.

-snapshot!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-snapshot! this)

Type signature:
  • (Any) → IRed

Returns the immutable or persistent snapshot of this. Both this and the returned object can be further freely used.

See also: ISnapshotable

ISorted

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with methods -key, -ascending?

Value protocol for sorted collections. Implementation should place comparator in the configuration. For backwards compatibility with Cojure, implementations should also implement c.l.Sorted interface and its methods.

See also: sorted?, ascending?

-key

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-key this item)

Type signature:
  • (Any ⨯ Any) → Any

Returns a key (from item) that is used to sort this.

See also: ISorted

-ascending?

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-ascending? this)

Type signature:
  • (Any) → Boolean+

Returns true if this is sorted in ascending order with regards to the comparator used for sorting, otherwise returns false. Users should use flip function to change the order of sorting.

See also: ISorted

ISortedSectionable

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -sorted-section

Value protocol for sorted sectionable collections.

-sorted-section

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-sorted-section this begin end)

Type signature:
  • (Any ⨯ Any ⨯ Any) → []

Returns new collection which is the result of sectioning this from begin inclusive into the end exclusive. nil in begin defaults to the first item and nil in the end defaults to the last item in this. Resulting coll will be of similar type and will share underlying data with this and thus will hold onto all original items. Operation is constant time though. Returned collection does not have to be persistent.

See also: ISortedSectionable

IStacked

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -pop

extensions of this protocol on existing types are forbidden (performance and/or backwards compatibility reasons).

A value protocol for stacked collections.

See also: stacked?, pop

-pop

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-pop this)

Type signature:
  • (Any) → IStacked

Returns this without one item at a position specified by the implementation. It may be the first item (Lists, Queues), or it may be the last item (Vector). Throws if this is empty.

See also: IStacked

IUnpackedRed

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -reduce-unpacked

A value protocol for multireducible collections. Multireducible collections can reduce a multiarg function (more than 2 args), instead of sending multiple values as a vector. Is supported for multireducibles, indexed reducibles and maps.

-reduce-unpacked

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-reduce-unpacked this reducef init)

Type signature:
  • (Any ⨯ AnyFn ⨯ Any) → Any

Returns the reduction of this where multiple values are sent directly into reducing function reducef instead of creating a temporary vector to send multiple values. May return postponed or reduced object. Implementations must correctly handle reduced and postponed references and care must be taken to correctly handle postponed results returned from underlying collection, if the implementation has one.

See also: IUnpackedRed

IUsageTracking

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -hit

A value protocol for collections tracking the usage of their items. Used e.g. for LRU caches.

See also: usage-tracking?, hit

-hit

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-hit this key)

Type signature:
  • (Any ⨯ Any) → IUsageTracking

Returns collection which has processed a hit (usage) notification of a value associated with key. Undefined behavior if this does not contain mapping for key.

See also: IUsageTracking