Liking cljdoc? Tell your friends :D

clojure.contrib.djui.core

Core helper functions.

Core helper functions.
raw docstring

assert-argscljmacro

(assert-args & pairs)
source

fargsclj

(fargs & args)

Return a function that takes a fn f yielding (apply f args). While partial is left-associative, fargs is right-associative.

Return a function that takes a fn f yielding (apply f args). While partial is
left-associative, fargs is right-associative.
sourceraw docstring

fixpointclj

(fixpoint f data-in)

Repeatedly call f with data-in until f(data-in) equals data-in.

Repeatedly call f with data-in until f(data-in) equals data-in.
sourceraw docstring

if-all-letcljmacro

(if-all-let bindings then)
(if-all-let bindings then else & oldform)

Similar to if-let but supports multiple binding terms which have to be true for the binding evaluation to continue.

Example: (if-all-let [a 1 b (dec a) c (pos? b)] [a b c] "failed") ;=> "failed"

Similar to if-let but supports multiple binding terms which have to be true
for the binding evaluation to continue.

Example:
  (if-all-let [a 1
               b (dec a)
               c (pos? b)]
    [a b c]
    "failed") ;=> "failed"
sourceraw docstring

ignorantlycljmacro

(ignorantly & exprs)

Execute f and return its result. In case an exception is thrown, catch it and return nil.

Execute f and return its result. In case an exception is thrown, catch it
and return nil.
sourceraw docstring

keep-ifclj

(keep-if x pre)
(keep-if x pre f)
(keep-if x pre f post)

Verify that (pre x) is true and return x, otherwise nil. If f is given, return (f x). If post is given, verify that (post (f x)) is true and return (f x), otherwise nil.

Example: (keep-if 5 even?) ;=> 5 (keep-if 5 even? dec) ;=> 4 (keep-if 5 even? dec even?) ;=> nil

Verify that (pre x) is true and return x, otherwise nil. If f is given,
return (f x). If post is given, verify that (post (f x)) is true and return
(f x), otherwise nil.

Example:
(keep-if 5 even?) ;=> 5
(keep-if 5 even? dec) ;=> 4
(keep-if 5 even? dec even?) ;=> nil
sourceraw docstring

lazycljmacro

(lazy & exprs)

Return a lazy sequence of the passed-in expressions. Each will be evaluated only if necessary.

Return a lazy sequence of the passed-in expressions. Each will be evaluated
only if necessary.
sourceraw docstring

let-ifcljmacro

(let-if test bindings & forms)

Choose a set of bindings based on the result of a conditional test.

Example: (let-if (even? a) [b (bar 1 2 3) (baz 1 2 3) c (foo 1) (foo 3)] (println (combine b c)))

Choose a set of bindings based on the result of a conditional test.

Example:
 (let-if (even? a)
         [b (bar 1 2 3) (baz 1 2 3)
          c (foo 1)     (foo 3)]
   (println (combine b c)))
sourceraw docstring

unlesscljmacro

(unless test body)

Same as if, but with negated predicate check.

Same as if, but with negated predicate check.
sourceraw docstring

verifyclj

(verify x test-f f)

Verify that (test-f x) is true and return x, otherwise return (f x).

Example: (verify 1 vector? vector) ;=> [1] (verify [1] vector? vector) ;=> [1]

Verify that (test-f x) is true and return x, otherwise return (f x).

Example:
(verify 1 vector? vector) ;=> [1]
(verify [1] vector? vector) ;=> [1]
sourceraw docstring

when-all-letcljmacro

(when-all-let bindings & body)

Similar to when-let but supports multiple binding terms which have to be true for the binding evaluation to continue. Same as if-all-let without the else case.

Example: (when-all-let [a 2 b (dec a) c (pos? b)] [a b c]) ;=> [2 1 true]

Similar to when-let but supports multiple binding terms which have to be true
for the binding evaluation to continue. Same as if-all-let without the else case.

Example:
  (when-all-let [a 2
                 b (dec a)
                 c (pos? b)]
    [a b c]) ;=> [2 1 true]
sourceraw docstring

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

× close