(assoc-nx m kvs)
(assoc-nx m k v)
(assoc-nx m k v & kvs)
Lazily assocs each kv if its key doesn't already exist. Macro version of taoensso.encore/assoc-nx
Lazily assocs each kv if its key doesn't already exist. Macro version of taoensso.encore/assoc-nx
(assoc-nx! a k v)
Lazily atom/assoc!
if the key does not already exist.
Returns the value in the atom
Lazily `atom/assoc!` if the key does not already exist. Returns the value in the atom
(catch->identity & body)
Wraps the body
in a catch block, returning the result of the body
or any thrown exception
Wraps the `body` in a catch block, returning the result of the `body` or any thrown exception
(catch->nil & body)
Wraps the body
in a catch block, returning all thrown exceptions as nil
Wraps the `body` in a catch block, returning all thrown exceptions as `nil`
(condf v & clauses)
Takes a value, and a set of binary predicate clauses.
For each clause (clause v)
is evaluated. If it returns logical true, the clause is a match and the result-expr is returned.
A single default expression can follow the clauses, and its value will be returned if no clause matches.
(condf {:map 1}
map? "map"
string? "string"
nil)
Takes a value, and a set of binary predicate clauses. For each clause `(clause v)` is evaluated. If it returns logical true, the clause is a match and the result-expr is returned. A single default expression can follow the clauses, and its value will be returned if no clause matches. ```clojure (condf {:map 1} map? "map" string? "string" nil) ```
(def- symbol)
(def- symbol init)
(def- symbol doc-string init)
Creates and interns a private var with the name of symbol in the
current namespace (*ns*
) or locates such a var if it already exists.
If init is supplied, it is evaluated, and the root binding of the
var is set to the resulting value. If init is not supplied, the
root binding of the var is unaffected.
Creates and interns a private var with the name of symbol in the current namespace (`*ns*`) or locates such a var if it already exists. If init is supplied, it is evaluated, and the root binding of the var is set to the resulting value. If init is not supplied, the root binding of the var is unaffected.
(defconsts body-fn & symbols)
Defines a collection of string constant values as individual symbols transforming their values using body-fn.
Defines a collection of string constant values as individual symbols transforming their values using body-fn.
(defkw kw)
Defines a symbol as the name of the given keyword in the current namespace
Defines a symbol as the name of the given keyword in the current namespace
(import-vars & imports)
Imports a all symbols (including various metadata) from one namespace into the current namespace. Supports Clojure and ClojureScript. Similar to https://github.com/ztellman/potemkin
(import-vars
[io.jesi.backpack.collection
io.jesi.backpack.fn
...])
Imports a all symbols (including various metadata) from one namespace into the current namespace. Supports Clojure and ClojureScript. Similar to https://github.com/ztellman/potemkin ```clojure (import-vars [io.jesi.backpack.collection io.jesi.backpack.fn ...]) ```
(macro? sym)
True if the provided sym
is a macro
True if the provided `sym` is a macro
(ns-of sym)
Gets the namespace (as string) of the provided symbol
Gets the namespace (as string) of the provided symbol
(reify-ifn invoke-fn & more)
Defines IFn invoke implementations to call as (invoke-fn this [args])
.
Note: Protocols do not support var args
Defines IFn invoke implementations to call as `(invoke-fn this [args])`. Note: Protocols do not support var args
(shorthand & symbols)
Returns a map with the keywords from the symbol names
Returns a map with the keywords from the symbol names
(shorthand-str & symbols)
String shorthand
. Returns a map with string keys from the symbol names
String `shorthand`. Returns a map with string keys from the symbol names
(try* & body)
Macro to catch multiple exceptions within a single body
(try*
(condp = x
0 (throw (Exception. "Exception"))
1 (throw (RuntimeException. "Runtime"))
3 (throw (ArithmeticException. "Arithmetic"))
"Not Caught")
(catch ArithmeticException _ "ArithmeticException")
(catch-any [RuntimeException SecurityException] _ "Multi")
(catch Exception _ "Exception"))))
Macro to catch multiple exceptions within a single body ```clojure (try* (condp = x 0 (throw (Exception. "Exception")) 1 (throw (RuntimeException. "Runtime")) 3 (throw (ArithmeticException. "Arithmetic")) "Not Caught") (catch ArithmeticException _ "ArithmeticException") (catch-any [RuntimeException SecurityException] _ "Multi") (catch Exception _ "Exception")))) ```
(with-open bindings & body)
bindings => [sym init ...]
Evaluates body in a try expression with symbols bound to the values of the inits, and a finally clause that calls (bp/close sym) on each sym in reverse order.
bindings => [sym init ...] Evaluates body in a try expression with symbols bound to the values of the inits, and a finally clause that calls (bp/close sym) on each sym in reverse order.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close