Liking cljdoc? Tell your friends :D

utilis.coll


distinct-byclj/s

(distinct-by f)
(distinct-by f coll)

Returns a lazy sequence of the elements of coll, removing any elements that return duplicate values when passed to a function f. Returns a transducer when no collection is provided.

Returns a lazy sequence of the elements of coll, removing any elements that
return duplicate values when passed to a function f. Returns a transducer
when no collection is provided.
sourceraw docstring

insert-atclj/s

(insert-at coll index item)

Inserts item into the coll at index. Items already in coll after index are shifted forward to accommodate item.

It is the responsibility of the caller to ensure that the index is within bounds.

Inserts `item` into the `coll` at `index`. Items already in `coll` after
`index` are shifted forward to accommodate `item`.

It is the responsibility of the caller to ensure that the index is within
bounds.
sourceraw docstring

key-byclj/s

(key-by key-fn coll)

Returns a map whose keys are the value returned by the key-fn applied to each value in the coll. If the key-fn returns a key more than once, the last value is used.

Returns a map whose keys are the value returned by the `key-fn`
applied to each value in the coll.  If the `key-fn` returns a key
more than once, the last value is used.
sourceraw docstring

llastclj/s

(llast nested-coll)

Returns the last item of the last collection.

Returns the last item of the last collection.
sourceraw docstring

nth-lastclj/s

(nth-last coll index)
(nth-last coll index default)

Returns the nth last item in the collection. Throws an exception if the index is out of bounds unless default is supplied.

Returns the nth last item in the collection.  Throws an exception if
the index is out of bounds unless `default` is supplied.
sourceraw docstring

onlyclj/s

(only s)
(only s exception-message)

Returns the first element from s iff it's the only element in s. If s does not contain exactly 1 element, an IllegalAgumentException or js/Error is thrown. The message for the exceptions can be optionally specified.

Returns the first element from `s` iff it's the only element in `s`.
If `s` does not contain exactly 1 element, an IllegalAgumentException
or js/Error is thrown. The message for the exceptions can be optionally
specified.
sourceraw docstring

remove-atclj/s

(remove-at coll index)

Removed the item at index from coll. Subsequent items are shifted to ensure that there are no gaps in the collection.

It is the responsibility of the caller to ensure that the index is within bounds.

Removed the item at `index` from `coll`. Subsequent items are shifted
to ensure that there are no gaps in the collection.

It is the responsibility of the caller to ensure that the index is within
bounds.
sourceraw docstring

second-lastclj/s

(second-last coll)

Returns the second last item in the collection.

Returns the second last item in the collection.
sourceraw docstring

take-untilclj/s

(take-until pred coll)

Returns a lazy sequence of successive items from coll until (pred item) returns logical true. The last item, which returned true, is included in the output. pred must be free of side-effects. Transducer not implemented.

Returns a lazy sequence of successive items from coll until
(pred item) returns logical true. The last item, which returned
true, is included in the output.  pred must be free of
side-effects.  Transducer not implemented.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close