Liking cljdoc? Tell your friends :D

fooheads.stdlib


apply-ifclj/s

(apply-if pred f & args)

Returns a function that applies f if pred returns true for the specified value.

Usually used in combination with clojure.walk/postwalk, e.g.

(postwalk (apply-if keyword? str) coll)

Returns a function that applies f if pred returns true for the specified
value.

Usually used in combination with `clojure.walk/postwalk`, e.g.

`(postwalk (apply-if keyword? str) coll)`
raw docstring

binding-mapclj/s

(binding-map symbols)

cljs-env?clj/s

(cljs-env? env)

Take the &env from a macro, and tell whether we are expanding into cljs.

Take the &env from a macro, and tell whether we are expanding into cljs.
raw docstring

conj-someclj/s

(conj-some coll x)

Like conj but does not add x if x is nil.

Like `conj` but does not add x if x is nil.
raw docstring

conjtclj/s

(conjt coll x)

Like conj, keeps the collection type and throws error for seq? collections, since it would be very slow (and in the "wrong" order). If coll is nil, defaults to vector (instead of list as conj does).

Like `conj`, keeps the collection type and throws error for `seq?` collections,
since it would be very slow (and in the "wrong" order). If coll is nil,
defaults to vector (instead of list as conj does).
raw docstring

conjt-someclj/s

(conjt-some coll x)

Like conjt but does not add x if x is nil.

Like `conjt` but does not add x if x is nil.
raw docstring

cons-someclj/s

(cons-some x coll)

Like cons but does not add x if x is nil.

Like `cons` but does not add x if x is nil.
raw docstring

constclj/s

(const x coll)

Like cons but keeps the collection type.

Like `cons` but keeps the collection type.
raw docstring

const-someclj/s

(const-some x coll)

Like const but does not add x if x is nil.

Like `const` but does not add x if x is nil.
raw docstring

dissoc-valsclj/s

(dissoc-vals m pred)

Dissoc elements from m for which value matches pred

Dissoc elements from m for which value matches pred
raw docstring

dprnclj/smacro

(dprn msg-template & symbols)

Renders the template using the scoped vars, println's the msg and pprint's the arg-map

Renders the template using the scoped vars,
println's the msg and pprint's the arg-map
raw docstring

emptyclj/s

(empty coll)

Like clojure.core/empty with support for map-entry.

Like clojure.core/empty with support for map-entry.
raw docstring

empty-vecclj/s

(empty-vec & _args)

Create an empty vector

Create an empty vector
raw docstring

every-partition?clj/s

(every-partition? pred n coll)
(every-partition? pred n step coll)
(every-partition? pred n step pad coll)

Is pred true for every partition?

Is pred true for every partition?
raw docstring

exactly=clj/s

(exactly= x y)

Checks that = is true and that both x and y are of the same type.

Checks that `=` is true and that both x and y are of the same type.
raw docstring

exceptionalclj/s

(exceptional f success? get)

Returns a function that applies f and uses the specified get function to retrieve the value if success? returns true for the function application.

Throws an exception if success? returns something falsy.

Returns a function that applies f and uses the specified
get function to retrieve the value if success? returns true for the
function application.

Throws an exception if success? returns something falsy.
raw docstring

filter-indexesclj/s

(filter-indexes indexes xs)

Selects the items at the indexes.

Example: (select-indexes [0 2] [:a :b :c :d]) ; => [:a :c]

Selects the items at the indexes.

Example: (select-indexes [0 2] [:a :b :c :d]) ; => [:a :c]
raw docstring

filtertclj/s

(filtert pred coll)

Like filter but keeps the collection type.

Like `filter` but keeps the collection type.
raw docstring

forvclj/smacro

(forv seq-exprs body-expr)

Just like clojure.core/for, but removes lazyness and returns a vector.

Just like `clojure.core/for`, but removes lazyness and returns a vector.
raw docstring

guardclj/smacro

(guard pred v msg)
(guard pred v msg data-map)

A guard that throws an exception (with msg) if v does not meet pred.

A guard that throws an exception (with msg) if v does not meet pred.
raw docstring

index-ofclj/s

(index-of pred coll)

Returns the index of the first element matching pred in coll

Returns the index of the first element matching pred in coll
raw docstring

index-of-allclj/s

(index-of-all pred coll)

Returns the indexes of all elements matching pred in coll

Returns the indexes of all elements matching pred in coll
raw docstring

intoclj/s

(into)
(into to)
(into to from)

Like clojure.core/into, but keeps the original order for lists. Does not support transducers.

Like clojure.core/into, but keeps the original order for lists.
Does not support transducers.
raw docstring

map-keysclj/s

(map-keys f m)

Apply f to all keys in m

Apply f to all keys in m
raw docstring

map-valsclj/s

(map-vals f m)

Apply f to all values in m

Apply f to all values in m
raw docstring

maptclj/s

(mapt f coll)
(mapt f c1 c2)
(mapt f c1 c2 c3)
(mapt f c1 c2 c3 & colls)

Like map but keeps the collection type. For maps, it assumes that f returns a pair/map-entry, in order to successfully turn the values into a map again. When multiple collections are provided, the type of the first collection determines the return type.

Like `map` but keeps the collection type. For maps, it assumes that
f returns a pair/map-entry, in order to successfully turn the values
into a map again. When multiple collections are provided, the type of
the first collection determines the return type.
raw docstring

named?clj/s

(named? x)

Returns true if clojure.core/name can be called on x.

Returns true if `clojure.core/name` can be called on x.
raw docstring

partition-indexesclj/s

(partition-indexes indexes xs)

Partitions the seq into the number of specified index partitions. If the index is not specified, it will be put in the last partition.

Example: (partition-indexes [[0 3] [1]] [:a :b :c :d :e]) ;=> [[:a :d] [:b] [:c :e]]

Partitions the seq into the number of specified index partitions.
If the index is not specified, it will be put in the last partition.

Example:
  (partition-indexes [[0 3] [1]] [:a :b :c :d :e])
  ;=> [[:a :d] [:b] [:c :e]]
raw docstring

partition-usingclj/s

(partition-using pred coll)

Collects values to a partition until the pred is true for the partition, and then starts a new partition. If pred never is true, all values ends up in a single partition. Returns a lazy seq of partitions.

When I grow up, I want to return a (stateful) transducer when only pred is provided.

Collects values to a partition until the pred is true for the partition,
and then starts a new partition.  If pred never is true, all values ends
up in a single partition.  Returns a lazy seq of partitions.

When I grow up, I want to return a (stateful) transducer when only pred is
provided.
raw docstring

qualified-nameclj/s

(qualified-name ident)

Returns a string with the qualified name of the ident

Returns a string with the qualified name of the ident
raw docstring

qualify-identclj/s

(qualify-ident nspace nameable)

Qualifies an ident. nspace and nameable must of same type. The nspace must be a simple-ident? and nameable can be either simple-ident? or qualified-ident?.

If nameable is already qualified, it will change namespace.

Qualifies an ident. nspace and nameable must of same
type. The nspace must be a `simple-ident?` and nameable
can be either `simple-ident?` or `qualified-ident?`.

If nameable is already qualified, it will change namespace.
raw docstring

qualify-keysclj/s

(qualify-keys m nspace)

Qualify all the keys in a map

Qualify all the keys in a map
raw docstring

re->strclj/s


regex?clj/s

(regex? x)

Test whether x is a regular expression

Test whether x is a regular expression
raw docstring

remove-indexesclj/s

(remove-indexes indexes xs)

Removes the items at the indexes.

Example: (remove-indexes [0 2] [:a :b :c :d]) ; => [:b :d]

Removes the items at the indexes.

Example: (remove-indexes [0 2] [:a :b :c :d]) ; => [:b :d]
raw docstring

removetclj/s

(removet pred coll)

Like remove but keeps the collection type.

Like `remove` but keeps the collection type.
raw docstring

render-templateclj/s

(render-template template args)

Renders the template using args for data. Example:

(render-template "Error: {error-code}" {:error-code 11}) ; => "Error: 11"

Renders the template using args for data.
Example:

`(render-template "Error: {error-code}" {:error-code 11})`
; => "Error: 11" 
raw docstring

seq->clj/smacro

(seq-> expr & forms)

When expr is a seq (clojure.core/seq not returns nil), threads it into the first form (via ->), and when that result is a seq, through the next etc

When expr is a seq (`clojure.core/seq` not returns nil), threads it into the
first form (via ->), and when that result is a seq, through the next etc
raw docstring

seq->>clj/smacro

(seq->> expr & forms)

When expr is a seq (`clojure.core/seq not returns nil), threads it into the first form (via ->>), and when that result is a seq, through the next etc

When expr is a seq (`clojure.core/seq not returns nil), threads it into the
first form (via ->>), and when that result is a seq, through the next etc
raw docstring

seqtclj/s

(seqt coll)

Like seq but returns the original coll if not empty

Like `seq` but returns the original coll if not empty
raw docstring

simple-identclj/s

(simple-ident ident)

Takes an ident and unqualifies it (removed the namespace). Returns the same type of ident as was provided. Returns nil if ident is not an ident.

Takes an ident and unqualifies it (removed the namespace). Returns the same
type of ident as was provided. Returns nil if `ident` is not an ident.
raw docstring

simple-keywordclj/s

(simple-keyword s)

Forces a simple keyword. Useful when forward slashes can be present in the string s

Forces a simple keyword. Useful when forward slashes can
be present in the string `s`
raw docstring

simple-symbolclj/s

(simple-symbol s)

Forces a simple symbol Useful when forward slashes can be present in the string s

Forces a simple symbol Useful when forward slashes can
be present in the string `s`
raw docstring

singleton?clj/s

(singleton? coll)

Returns true if the coll has exactly one element, false otherwise.

Returns true if the `coll` has exactly one element, false otherwise.
raw docstring

some-partitionclj/s

(some-partition pred n coll)
(some-partition pred n step coll)
(some-partition pred n step pad coll)

some pred for each partition.

`some` pred for each partition.
raw docstring

substringclj/s

(substring s start end)

template-paramsclj/s

(template-params template)

Calculate a sequence of params required by the template

Calculate a sequence of params required by the template
raw docstring

throw-exclj/smacro

(throw-ex msg-template & symbols)

Throw an exception with a msg template and optional vars. The msg template will be rendered using the scoped vars and the template args and vars will be put in the map to ex-info.

Example:

`(let [namn "foohead" age 8] (throw-ex "Hello {namn}" age))

; => {:age 8, :namn "foohead", :msg "Hello foohead"}`

Throw an exception with a msg template and optional vars.
The msg template will be rendered using the scoped vars and
the template args and vars will be put in the map to ex-info.

Example:

`(let [namn "foohead"
       age 8]
   (throw-ex "Hello {namn}" age))

; => {:age 8, :namn "foohead", :msg "Hello foohead"}`
raw docstring

transposeclj/s

(transpose xs)

Transpose a seq of seqs. Returns a vector of vectors.

Transpose a seq of seqs. Returns a vector of vectors.
raw docstring

unqualify-identclj/s

(unqualify-ident ident)

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

× close