(?assoc m & kvs)
Same as clojure.core/assoc, but skip the assoc if v is nil
Same as clojure.core/assoc, but skip the assoc if v is nil
(?conj coll & xs)
Same as conj, but skip the conj if v is falsey
Same as conj, but skip the conj if v is falsey
(?hash-map & keyvals)
Creates a hash-map from all key value pairs where value is not nil.
Creates a hash-map from all key value pairs where value is not nil.
(?move-in m from to)
Moves a value in nested assoc structure, if it is not nil.
Moves a value in nested assoc structure, if it is not nil.
(?update m k f & args)
Performs a clojure.core/update if the original or resulting value is truthy, otherwise dissoc key.
Performs a clojure.core/update if the original or resulting value is truthy, otherwise dissoc key.
(?update-in m [k & ks] f & args)
Performs a clojure.core/update-in if the original or resulting value is truthy, otherwise dissoc key.
Performs a clojure.core/update-in if the original or resulting value is truthy, otherwise dissoc key.
(ascii s)
Ensures all characters in the given string are converted to ASCII. For example: ā->a.
Ensures all characters in the given string are converted to ASCII. For example: ā->a.
(assoc-first m k)
Replaces value of key k
in map m
with the first value sequence
first item from map given key to resultant map.
Replaces value of key `k` in map `m` with the first value sequence first item from map given key to resultant map.
(def-name sym)
Returns human readable name of defined symbol (such as def or defn).
Returns human readable name of defined symbol (such as def or defn).
(dq s)
Converts single quotes to double quotes.
Converts single quotes to double quotes.
(ellapsed-time time-bookmark)
Returns ellapsed time in milliseconds since the time bookmark.
Returns ellapsed time in milliseconds since the time bookmark.
(idx-of collection item)
Similar to .indexOf, but works with lazy collections as well.
Similar to .indexOf, but works with lazy collections as well.
(if->> cnd & threads)
Using if + ->> inside ->> threads Takes a single condition and one or more forms that will be executed if the condition is true. An else block can be passed in by separating forms with :else keyword. Contition can take the initial value as argument, it needs to be referenced as '%' (eg, (some-condition %) (->> (range 10) (if->> false (filter odd?) (map inc) :else (filter even?) (map dec))) => (-1 1 3 5 7)
Using if + ->> inside ->> threads Takes a single condition and one or more forms that will be executed if the condition is true. An else block can be passed in by separating forms with :else keyword. Contition can take the initial value as argument, it needs to be referenced as '%' (eg, (some-condition %) (->> (range 10) (if->> false (filter odd?) (map inc) :else (filter even?) (map dec))) => (-1 1 3 5 7)
(if-cljs then else)
Return then if we are generating cljs code and else for Clojure code. https://groups.google.com/d/msg/clojurescript/iBY5HaQda4A/w1lAQi9_AwsJ
Return then if we are generating cljs code and else for Clojure code. https://groups.google.com/d/msg/clojurescript/iBY5HaQda4A/w1lAQi9_AwsJ
(index-by kf coll)
(index-by kf vf coll)
Returns a map of the values in coll indexed by the result of applying kf. A value mapping function vf can be provided too.
Returns a map of the values in coll indexed by the result of applying kf. A value mapping function vf can be provided too.
(insert-at s idx i)
Returns the sequence s with the item i inserted at 0-based index idx.
Returns the sequence s with the item i inserted at 0-based index idx.
(juxt-partition pred coll & fns)
Takes a predicate function, a collection and one ore more (fn predicate coll) functions that will be applied to the given collection. Example: (juxt-partition odd? [1 2 3 4] filter remove) => [(1 3) (2 4)].
Takes a predicate function, a collection and one ore more (fn predicate coll) functions that will be applied to the given collection. Example: (juxt-partition odd? [1 2 3 4] filter remove) => [(1 3) (2 4)].
(move-in m from to)
Moves a value in nested assoc structure.
Moves a value in nested assoc structure.
(nest-> & threads)
Allows to sneak in ->s inside ->>s. (->> (range 3) (map inc) (nest-> (nth 1) inc) (str "x")) => x3
Allows to sneak in ->s inside ->>s. (->> (range 3) (map inc) (nest-> (nth 1) inc) (str "x")) => x3
(pipe)
Returns a vector containing a sequence that will read from the queue, and a function that inserts items into the queue.
Returns a vector containing a sequence that will read from the queue, and a function that inserts items into the queue.
(re-quote s)
Returns a literal regex pattern for given string, similiar to Java's Pattern.quote.
Returns a literal regex pattern for given string, similiar to Java's Pattern.quote.
(remap m mapping)
Remap keys of m
based on mapping
.
Remap keys of `m` based on `mapping`.
(remove-at s idx)
Returns the sequence s with the element at 0-based index idx removed.
Returns the sequence s with the element at 0-based index idx removed.
(remove-empty-val m)
Filter empty? values from map.
Filter empty? values from map.
(remove-nil-val m)
Filter nil values from a map m.
Filter nil values from a map m.
(replace-at s idx i)
Returns the sequence s with the item at 0-based index idx.
Returns the sequence s with the item at 0-based index idx.
(some-when pred coll)
Similiar to some but returns matching value instead of predicates result.
Similiar to some but returns matching value instead of predicates result.
(str-greater? this that)
Returns true if this is greater than that. Case insensitive.
Returns true if this is greater than that. Case insensitive.
(str-smaller? this that)
Returns true if this is smaller than that. Case insensitive.
Returns true if this is smaller than that. Case insensitive.
(strip s cs)
Takes a string s and a string cs. Removes all cs characters from s.
Takes a string s and a string cs. Removes all cs characters from s.
(time-bookmark)
Returns time bookmark (technically system time in nanoseconds). For use in concert with ellapsed-time to messure execution time of some code block.
Returns time bookmark (technically system time in nanoseconds). For use in concert with ellapsed-time to messure execution time of some code block.
(update-first s m)
(update-first s m & args)
Updates first item in sequence s by applying mapping method m to it.
Updates first item in sequence s by applying mapping method m to it.
(update-last s m)
(update-last s m & args)
Updates last item in sequence s by applying mapping method m to it.
Updates last item in sequence s by applying mapping method m to it.
(when-> thread cnd & threads)
Using when + -> inside -> threads Takes a single condition and multiple forms that will be executed like a normal -> if the condition is true. Contition can take the initial value as argument, it needs to be referenced as '%' (eg, (some-condition %) (-> "foobar" (upper-case) (when-> true (str "baz"))) => FOOBARbaz
Using when + -> inside -> threads Takes a single condition and multiple forms that will be executed like a normal -> if the condition is true. Contition can take the initial value as argument, it needs to be referenced as '%' (eg, (some-condition %) (-> "foobar" (upper-case) (when-> true (str "baz"))) => FOOBARbaz
(when->> cnd & threads)
Using when + ->> inside ->> threads Takes a single condition and one or more forms that will be executed like a regular ->>, if condition is true. Will pass the initial value if condition is false. Contition can take the initial value as argument, it needs to be referenced as '%' (eg, (some-condition %) (->> (range 10) (map inc) (when->> true (filter even?))) => (2 4 6 8 10)
Using when + ->> inside ->> threads Takes a single condition and one or more forms that will be executed like a regular ->>, if condition is true. Will pass the initial value if condition is false. Contition can take the initial value as argument, it needs to be referenced as '%' (eg, (some-condition %) (->> (range 10) (map inc) (when->> true (filter even?))) => (2 4 6 8 10)
(when->>-> cnd & threads)
Using when + -> inside ->> threads. Takes a single condition cnd and multiple forms that will be exectued as a regular ->>, if the condition is true (otherwise the initial value will be passed to next form). Contition can take the initial value as argument, it needs to be referenced as '%' (eg, (some-condition %) (->> (range 3) (map inc) (when->>-> (seq %) (into ["header"]))) => ("header" 1 2 3)
Using when + -> inside ->> threads. Takes a single condition cnd and multiple forms that will be exectued as a regular ->>, if the condition is true (otherwise the initial value will be passed to next form). Contition can take the initial value as argument, it needs to be referenced as '%' (eg, (some-condition %) (->> (range 3) (map inc) (when->>-> (seq %) (into ["header"]))) => ("header" 1 2 3)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close