Skip to main content

Control Flow

  • case

    Takes an expression, and a set of clauses. Each clause can take the form of either: test-constant result-expr (test-c...

  • cond

    Takes a set of test/expr pairs. It evaluates each test one at a time. If a test returns logical true, cond evaluates an...

  • condp

    Takes a binary predicate, an expression, and a set of clauses. Each clause can take the form of either: test-expr resul...

  • if

    Evaluates test. If not the singular values nil or false, evaluates and yields then, otherwise, evaluates and yields else...

  • if-let

    bindings => binding-form test If test is true, evaluates then with binding-form bound to the value of test, if not, yi...

  • when

    Evaluates test. If logical true, evaluates body in an implicit do.

  • when-let

    bindings => binding-form test When test is true, evaluates body with binding-form bound to the value of test

  • when-not

    Evaluates test. If logical false, evaluates body in an implicit do.

  • Throwable->map

    Constructs a data representation for an Error with keys: :cause - root cause message :phase - error phase :via - caus...

  • catch

    catch-clause => (catch classname name expr*) finally-clause => (finally expr*) Catches and handles JavaScript exceptions...

  • ex-cause

    Returns exception cause (an Error / ExceptionInfo) if ex is an ExceptionInfo. Otherwise returns nil.

  • ex-data

    Returns exception data (a map) if ex is an ExceptionInfo. Otherwise returns nil.

  • ex-info

    Create an instance of ExceptionInfo, an Error type that carries a map of additional data.

  • ex-message

    Returns the message attached to the given Error / ExceptionInfo object. For non-Errors returns nil.

  • finally

    catch-clause => (catch classname name expr*) finally-clause => (finally expr*) Catches and handles JavaScript exceptions...

  • throw

    The expr is evaluated and thrown.

  • try

    catch-clause => (catch classname name expr*) finally-clause => (finally expr*) Catches and handles JavaScript exceptions...

  • assert

    Evaluates expr and throws an exception if it does not evaluate to logical true.

  • comment

    Ignores body, yields nil

  • delay

    Takes a body of expressions and yields a Delay object that will invoke the body only the first time it is forced (with f...

  • delay?

    returns true if x is a Delay created with delay

  • deref

    Also reader macro: @var/@atom/@delay. Returns the most-recently-committed value of ref. When applied to a var or atom, r...

  • do

    Evaluates the expressions in order and returns the value of the last. If no expressions are supplied, returns nil.

  • dotimes

    bindings => name n Repeatedly executes body (presumably for side-effects) with name bound to integers from 0 through n-...

  • doto

    Evaluates x then calls all of the methods and functions with the value of x supplied at the front of the given arguments...

  • ensure-reduced

    If x is already reduced?, returns it, else returns (reduced x)

  • eval

    Evaluates the form data structure (not text!) and returns the result. Delegates to cljs.core/*eval*. Intended for use in...

  • force

    If x is a Delay, returns the (possibly cached) value of its expression, else returns x

  • halt-when

    Returns a transducer that ends transduction when pred returns true for an input. When retf is supplied it must be a fn o...

  • if-not

    Evaluates test. If logical false, evaluates and returns then expr, otherwise else expr, if supplied, else nil.

  • if-some

    bindings => binding-form test If test is not nil, evaluates then with binding-form bound to the value of test, if not, ...

  • lazy-cat

    Expands to code which yields a lazy sequence of the concatenation of the supplied colls. Each coll expr is not evaluate...

  • letfn

    fnspec ==> (fname [params*] exprs) or (fname ([params*] exprs)+) Takes a vector of function specs and a body, and gener...

  • reduced

    Wraps x in a way such that a reduce will terminate with the value x

  • reduced?

    Returns true if x is the result of a call to reduced

  • time

    Evaluates expr and prints the time it took. Returns the value of expr.

  • unreduced

    If x is reduced?, returns (deref x), else returns x

  • when-first

    bindings => x xs Roughly the same as (when (seq xs) (let [x (first xs)] body)) but xs is evaluated only once

  • when-some

    bindings => binding-form test When test is not nil, evaluates body with binding-form bound to the value of test

  • with-redefs

    binding => var-symbol temp-value-expr Temporarily redefines vars while executing the body. The temp-value-exprs will b...

  • doseq

    Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by "for". Does not retai...

  • for

    List comprehension. Takes a vector of one or more binding-form/collection-expr pairs, each followed by zero or more mo...

  • loop

    Evaluates the exprs in a lexical context in which the symbols in the binding-forms are bound to their respective init-ex...

  • recur

    Evaluates the exprs in order, then, in parallel, rebinds the bindings of the recursion point to the values of the exprs....

  • trampoline

    trampoline can be used to convert algorithms requiring mutual recursion without stack consumption. Calls f with supplied...

  • while

    Repeatedly executes body while test expression is true. Presumes some side-effect will cause test to become false/nil. R...