Liking cljdoc? Tell your friends :D

dvlopt.void

Macros and functions for handling nil under various circumstances.

Macros and functions for handling nil under various circumstances.
raw docstring

altcljmacro

(alt)
(alt x)
(alt x & xs)

Selects the first non-nil value.

Being a macro, arguments are not evaluated until needed.

Ex. (alt nil false 42) => false

Selects the first non-nil value.

Being a macro, arguments are not evaluated until needed.

Ex. (alt nil
         false
         42)
    => false
sourceraw docstring

assocclj

(assoc hmap k v)
(assoc hmap k v & kvs)

Behaves like standard assoc but associates v only if it is not nil.

Behaves like standard `assoc` but associates `v` only if it is not nil.
sourceraw docstring

assoc-inclj

(assoc-in hmap path v)

Behaves like standard assoc-in but associates v only if it is not nil.

Behaves like standard `assoc-in` but associates `v` only if it is not nil.
sourceraw docstring

assoc-strictclj

(assoc-strict hmap k v)
(assoc-strict hmap k v & kvs)

If v is nil, not only is it not associated, the involved key is actually removed from the map.

If `v` is nil, not only is it not associated, the involved key is actually removed from the map.
sourceraw docstring

callcljmacro

(call f & args)

Calls f with the given arguments only if f is not nil.

Being a macro, the arguments are not evaluated if there are not needed.

Calls `f` with the given arguments only if `f` is not nil.

Being a macro, the arguments are not evaluated if there are not needed.
sourceraw docstring

dissoc-inclj

(dissoc-in hmap path)

Deep dissoc, natural counterpart of Clojure's assoc-in.

It is recursive, meaning that if dissociating a key results in an empty map, that map is itself removed from its parent (provided it is of course nested).

Eg. (dissoc-in {:a {:b 42} :c :ok} [:a :b])

=> {:c :ok}
Deep dissoc, natural counterpart of Clojure's `assoc-in`.

It is recursive, meaning that if dissociating a key results in an empty map, that map is itself removed from its
parent (provided it is of course nested).


Eg. (dissoc-in {:a {:b 42}
                :c :ok}
               [:a :b])

    => {:c :ok}
sourceraw docstring

dmergeclj

(dmerge & hmaps)

Deep merges the given maps.

Merging a key pointing to nil results in that key being dissociated. Similarly to dissoc-in, empty maps are recursively removed.

Eg. (dmerge {:a {:b 42}} {:a {:b nil} :c 42})

=> {:c 42}
Deep merges the given maps.

Merging a key pointing to nil results in that key being dissociated. Similarly to `dissoc-in`, empty maps are recursively
removed.


Eg. (dmerge {:a {:b 42}}
            {:a {:b nil}
             :c 42})

    => {:c 42}
sourceraw docstring

dmerge-withclj

(dmerge-with f & hmaps)

Is to dmerge what this namespace's version of merge-with is to merge.

Is to `dmerge` what this namespace's version of `merge-with` is to `merge`.
sourceraw docstring

dmerge-with*clj

(dmerge-with* f hmaps)
(dmerge-with* f hmap-1 hmap-2)

Like dmerge-with, but maps are provided in a collection.

Like `dmerge-with`, but maps are provided in a collection.
sourceraw docstring

mergeclj

(merge & hmaps)

Just like standard merge, but a key pointing to nil in the right map means it must be dissociated.

Eg. (merge {:a 42 :b 42} {:b nil :c 42})

 => {:a 42
     :c 42}
Just like standard `merge`, but a key pointing to nil in the right map means it must be dissociated.

Eg. (merge {:a 42
            :b 42}
           {:b nil
            :c 42})

     => {:a 42
         :c 42}
sourceraw docstring

merge-withclj

(merge-with f & hmaps)

Just like standard 'merge-with' but behaves like this namespace's version of merge: a key pointing to a nil value in a right map means it will be dissociated. The same applies when f returns nil.

Just like standard 'merge-with' but behaves like this namespace's version of `merge`: a key pointing to a nil value in a
right map means it will be dissociated. The same applies when `f` returns nil.
sourceraw docstring

merge-with*clj

(merge-with* f hmaps)

Just like this namespace's version of merge-with but maps are provided in a collection.

Just like this namespace's version of `merge-with` but maps are provided in a collection.
sourceraw docstring

no-opclj

(no-op)
(no-op _)
(no-op _ _)
(no-op _ _ _)
(no-op _ _ _ _)
(no-op _ _ _ _ _)
(no-op _ _ _ _ _ _)
(no-op _ _ _ _ _ _ _)
(no-op _ _ _ _ _ _ _ _)
(no-op _ _ _ _ _ _ _ _ & _)

Does absolutely nothing, but efficiently.

Does absolutely nothing, but efficiently.
sourceraw docstring

pruneclj

(prune node)

If node is a map, keys with nil values will be removed. In case of nested maps, the process is recursive.

If node is a map, keys with nil values will be removed. In case of nested maps, the process is recursive.
sourceraw docstring

updateclj

(update hmap k f)
(update hmap k f a)
(update hmap k f a b)
(update hmap k f a b c)
(update hmap k f a b c & more)

Just like standard update but returning a nil value results in the involved key being dissociated.

Just like standard `update` but returning a nil value results in the involved key being dissociated.
sourceraw docstring

update-inclj

(update-in hmap path f & args)

Just like standard update-in but once again, returning nil results in the involved key being dissociated.

Similarly to dissoc-in, empty maps are then recursively removed as well.

When an empty path is provided, nothing happens.

Just like standard `update-in` but once again, returning nil results in the involved key being dissociated.

Similarly to `dissoc-in`, empty maps are then recursively removed as well.

When an empty path is provided, nothing happens.
sourceraw docstring

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

× close