(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.
(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.
(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.
(llast nested-coll)
Returns the last item of the last collection.
Returns the last item of the last collection.
(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.
(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.
(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.
(second-last coll)
Returns the second last item in the collection.
Returns the second last item in the collection.
(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.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close