Liking cljdoc? Tell your friends :D

io.jesi.backpack.macros


assoc-nxclj/smacro

(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
sourceraw docstring

assoc-nx!clj/smacro

(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
sourceraw docstring

catch->clj/smacro

(catch-> handle & body)
source

catch->identityclj/smacro

(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
sourceraw docstring

catch->nilclj/smacro

(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`
sourceraw docstring

condfclj/smacro

(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)
```
sourceraw docstring

def-clj/smacro

(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.
sourceraw docstring

defconstsclj/smacro

(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.
sourceraw docstring

defkwclj/smacro

(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
sourceraw docstring

import-varsclj/smacro

(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
   ...])
```
sourceraw docstring

macro?clj

(macro? sym)

True if the provided sym is a macro

True if the provided `sym` is a macro
sourceraw docstring

ns-ofclj/smacro

(ns-of sym)

Gets the namespace (as string) of the provided symbol

Gets the namespace (as string) of the provided symbol
sourceraw docstring

reify-ifnclj/smacro

(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
sourceraw docstring

shorthandclj/smacro

(shorthand & symbols)

Returns a map with the keywords from the symbol names

Returns a map with the keywords from the symbol names
sourceraw docstring

shorthand*clj/s

(shorthand* keyfn symbols)
source

shorthand-assocclj/smacro

(shorthand-assoc map sym)
(shorthand-assoc map sym & more)
source

shorthand-strclj/smacro

(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
sourceraw docstring

try*clj/smacro

(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"))))
```
sourceraw docstring

when-debugclj/smacro

(when-debug & body)
source

when-not=clj/smacro

(when-not= test body)
source

with-openclj/smacro

(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.
sourceraw docstring

with-open->clj/smacro

(with-open-> x & forms)
source

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

× close