weaving.core

%|

macro

(%| & expr)

*|

(*| f & more-fns)

Equivalent to juxt.

->|

(->| & fns)

Returns a function that behaves like comp but composes functions from left to right.

<-|

(<-| v)

Equivalent to constantly.

=|

(=| & args)

Returns a function (g x) that returns (= x v).

and|

(and|)(and| f)(and| f & more-fns)

Returns a function f that runs fns in order on the arguments of f in the style of and, i.e. breaking out of the chain upon false or nil.

apply|

(apply| f)

Transforms a function f accepting one argument, presumably a sequence, into a function that applies this argument to f.

args|

(args| f & fs)

call

(call f & args)

Calls function f by applying args.

doto|

(doto|)(doto| & fns)

Returns a function that calls fns in order, passing to each one its argument before returning it.

each-arg|

(each-arg| f arg-f)

if|

(if| pred f)(if| pred f else)

Returns a function that will run f when pred succeeds or otherwise run else if it is provided (returns the passed value by default).

in|

(in| path f & more)

Transforms a one-argument function f into a function receiving one collection and applying f to the value at the location denoted by path in this collection. Multiple path+function pairs can follow.

juxtm|

(juxtm| m)(juxtm| k v & {:as more-kvs})

Like juxt except that functions are passed as values of a map whose shape is used to return their results, under the same key. The map can be an explicit map (one argument) or a flat, implicit map (variadic arguments).

not|

Equivalent to complement.

or|

(or|)(or| f)(or| f & more-fns)

Returns a function that runs fns in order in the style of or, i.e. breaking out of the chain if one returns something different than false or nil.

parse-int

(parse-int x)

unapply|

(unapply| f)

Transforms a function f accepting any number of arguments into a function working on these arguments as a list.

when|

(when| pred & fns)

Returns a function that will run the fns in order when pred succeeds or return the value that was passed in otherwise.

|

(| f & args)

Returns a function like the result of partial except that new args are added to the beginning of the parameter list rather than the end.

||

(|| f & args)

Returns a function that behaves like partial.

ø|

(ø| f)

Unpartialize the first argument of f, i.e. returns a function that will apply all but the first argument to f.

ø||

(ø|| f)

Unpartialize the last argument of f, i.e. returns a function that will apply all but the last argument to f.