Liking cljdoc? Tell your friends :D
Mostly clj/s.
Exceptions indicated.

merr.core


errclj/s

(err)
(err x)

Returns value as Error.

=> (type (err "foo")) merr.core.MerrError

=> @(err "foo") "foo"

Returns value as Error.

=> (type (err "foo"))
merr.core.MerrError

=> @(err "foo")
"foo"
sourceraw docstring

err?clj/s

(err? x)

Returns true if x is Error.

=> (err? "foo") false

=> (err? (err "foo")) true

Returns true if x is Error.

=> (err? "foo")
false

=> (err? (err "foo"))
true
sourceraw docstring

if-letclj/smacro

(if-let err-sym bindings then)
(if-let err-sym bindings then else & oldform)

bindings => binding-form init-expr If there is no Error, evaluates then with binding-form, if not, yields else.

=> (if-let error [a 1 => b (inc a)] => b (err? error)) 2

=> (if-let error [a (err "ERR") => b (inc a)] => b :ng) :ng

=> (if-let error [a (err "ERR") => b (inc a)] => b) err?

bindings => binding-form init-expr
 If there is no Error, evaluates `then` with binding-form,
 if not, yields `else`.

=> (if-let error [a 1
=>                b (inc a)]
=>   b (err? error))
2

=> (if-let error [a (err "ERR")
=>                b (inc a)]
=>   b :ng)
:ng

=> (if-let error [a (err "ERR")
=>                b (inc a)]
=>   b)
err?
sourceraw docstring

letclj/smacro

(let err-sym bindings & body)

binding => binding-form init-expr If init-expr is not Error, binding-form bound to the value, if not, err-sym bound to the Error value and rest bindings are skipped.

=> (let error [a 1 => b (inc a)] => [b error]) [2 nil]

=> (let error [a (err "ERR") => b (inc a)] => [b (err? error)]) [nil true]

binding => binding-form init-expr
 If init-expr is not Error, binding-form bound to the value,
 if not, err-sym bound to the Error value and rest bindings are skipped.

=> (let error [a 1
=>             b (inc a)]
=>   [b error])
[2 nil]

=> (let error [a (err "ERR")
=>             b (inc a)]
=>   [b (err? error)])
[nil true]
sourceraw docstring

MerrErrorcljs

source

when-letclj/smacro

(when-let bindings & body)

bindings => binding-form init-expr If there is not Error, evaluates body with binding-form, if not, returns Error.

=> (when-let [a 1 => b (inc a)] => b) 2

=> (when-let [a (err "ERR") => b (inc a)] => b) err?

bindings => binding-form init-expr
 If there is not Error, evaluates body with binding-form,
 if not, returns Error.

=> (when-let [a 1
=>            b (inc a)]
=>   b)
2

=> (when-let [a (err "ERR")
=>            b (inc a)]
=>   b)
err?
sourceraw docstring

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

× close