(all-unique? coll)
checks if elements in the collection are unique
(all-unique? [1 2 3 4]) => true
(all-unique? [1 2 1 4]) => false
checks if elements in the collection are unique (all-unique? [1 2 3 4]) => true (all-unique? [1 2 1 4]) => false
(conj-unique coll x)
assumes vector is a set, adding only unique elements
(conj-unique [1 2 3] 1) => [1 2 3]
(conj-unique [1 2 3] 4) => [1 2 3 4]
assumes vector is a set, adding only unique elements (conj-unique [1 2 3] 1) => [1 2 3] (conj-unique [1 2 3] 4) => [1 2 3 4]
(element-of pred coll)
finds the element within an array
(element-of keyword? [1 2 :hello 4]) => :hello
finds the element within an array (element-of keyword? [1 2 :hello 4]) => :hello
(flatten-all x)
flattens all elements the collection
(flatten-all [1 2 #{3 {4 5}}]) => [1 2 3 4 5]
flattens all elements the collection (flatten-all [1 2 #{3 {4 5}}]) => [1 2 3 4 5]
(index-of pred coll)
finds the index of the first matching element in an array
(index-of even? [1 2 3 4]) => 1
(index-of keyword? [1 2 :hello 4]) => 2
finds the index of the first matching element in an array (index-of even? [1 2 3 4]) => 1 (index-of keyword? [1 2 :hello 4]) => 2
(insert-index coll i new)
(insert-index coll i new & more)
insert one or more elements at the given index
(insert-index [:a :b] 1 :b :c) => [:a :b :c :b]
insert one or more elements at the given index (insert-index [:a :b] 1 :b :c) => [:a :b :c :b]
(move coll from to)
moves item from one index to the other
(move [1 2 3 4] 1 3) => [1 3 4 2]
moves item from one index to the other (move [1 2 3 4] 1 3) => [1 3 4 2]
(move-down coll i)
(move-down coll i step)
move item at index i
down step
positions
(move-down [1 2 3 4] 0) => [2 1 3 4]
move item at index `i` down `step` positions (move-down [1 2 3 4] 0) => [2 1 3 4]
(move-down? coll i)
(move-down? coll i step)
checks if item at index i
can move down
(move-down? [1 2 3 4] 0) => true
checks if item at index `i` can move down (move-down? [1 2 3 4] 0) => true
(move-swap coll i j)
swaps items in list around
(move-swap [1 2 3 4] 2 3) => [1 2 4 3]
swaps items in list around (move-swap [1 2 3 4] 2 3) => [1 2 4 3]
(move-up coll i)
(move-up coll i step)
move item at index i
up step
positions
(move-up [1 2 3 4] 3) => [1 2 4 3]
move item at index `i` up `step` positions (move-up [1 2 3 4] 3) => [1 2 4 3]
(move-up? coll i)
(move-up? coll i step)
checks if item at index i
can move up
(move-up? [1 2 3 4] 0) => false
checks if item at index `i` can move up (move-up? [1 2 3 4] 0) => false
(move? coll from to)
can move item from one index to the other
(move? [1 2 3 4] 1 3) => true
can move item from one index to the other (move? [1 2 3 4] 1 3) => true
(positions pred coll)
find positions of elements matching the predicate
(positions even? [5 5 4 4 3 3 2 2]) => [2 3 6 7]
find positions of elements matching the predicate (positions even? [5 5 4 4 3 3 2 2]) => [2 3 6 7]
(remove-index coll i)
(remove-index coll i n)
removes element at the specified index
(remove-index [:a :b :c :d] 2) => [:a :b :d]
removes element at the specified index (remove-index [:a :b :c :d] 2) => [:a :b :d]
(seqify x)
converts an individual element into a sequence
(seqify 1) => [1]
(seqify [1 2 3]) => [1 2 3]
converts an individual element into a sequence (seqify 1) => [1] (seqify [1 2 3]) => [1 2 3]
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close