Liking cljdoc? Tell your friends :D

com.nomistech.clj-utils


cl-exceptionclj/s

(cl-exception cl-format-string & format-args)
source

deep-mergeclj/s

(deep-merge & vals)

Recursively merges maps. nil is treated as an empty map (to match the behaviour of merge). If vals are not maps, the last value wins.

Recursively merges maps.
`nil` is treated as an empty map (to match the behaviour of `merge`).
If vals are not maps, the last value wins.
sourceraw docstring

do1clj/smacro

(do1 form-1 & other-forms)

Evaluates all the forms and returns the result of the first form.

Evaluates all the forms and returns the result of the first form.
sourceraw docstring

do2clj/smacro

(do2 form-1 form-2 & other-forms)

Evaluates all the forms and returns the result of the second form.

Evaluates all the forms and returns the result of the second form.
sourceraw docstring

dotdotclj/smacro

(dotdot x)
(dotdot x & forms)

Like .. but allows only a single arg, so (dotdot foo) expands to foo.

Like `..` but allows only a single arg, so `(dotdot foo)` expands to `foo`.
sourceraw docstring

drop-nthclj/s

(drop-nth n coll)

Return a lazy sequence of all items in coll apart from the n'th item.

Return a lazy sequence of all items in coll apart from the n'th item.
sourceraw docstring

econdclj/smacro

(econd & clauses)

Like cond, except throws a RuntimeException if no clause matches.

Like `cond`, except throws a RuntimeException if no clause matches.
sourceraw docstring

edit-nthclj/s

(edit-nth n coll f)

Return a lazy sequence of all items in coll, with the n'th item replaced with the value of applying f to it.

Return a lazy sequence of all items in coll, with the n'th item
replaced with the value of applying `f` to it.
sourceraw docstring

emacs-temp-file-path?clj

(emacs-temp-file-path? path)
source

emacs-temp-file?clj

(emacs-temp-file? file)
source

Exception-or-js-Errorclj/s

source

fun-with-extrasclj/s

(fun-with-extras before-f after-f finally-f f)
source

fun-with-return-429-if-too-many-requestsclj/s

(fun-with-return-429-if-too-many-requests options fun)

options is a map with the following keys:

  • :limiter-id
  • :max-concurrent-requests
  • :min-retry-after-secs
  • :max-retry-after-secs If we currently do not have too many concurrent executions, call fun. Otherwise return a Ring response map with status 429 and a Retry-After value that is between min-retry-after-secs and max-retry-after-secs. Not having too many concurrent executions is defined like this:
  • consider the number of current executions of this function that share the supplied limiter-id
  • this number must be less than max-concurrent-requests.
`options` is a map with the following keys:
  - :limiter-id
  - :max-concurrent-requests
  - :min-retry-after-secs
  - :max-retry-after-secs
If we currently do not have too many concurrent executions, call `fun`.
Otherwise return a Ring response map with status 429 and a Retry-After value
that is between `min-retry-after-secs` and `max-retry-after-secs`.
Not having too many concurrent executions is defined like this:
- consider the number of current executions of this function that share the
  supplied `limiter-id`
- this number must be less than `max-concurrent-requests`.
sourceraw docstring

group-by-kclj/s

(group-by-k f m)
source

group-by-kvclj/s

(group-by-kv f m)
source

group-by-vclj/s

(group-by-v f m)
source

indexedclj/s

(indexed coll)

Return a lazy sequence of [index, item] pairs, where items come from 'coll' and indexes count up from zero. eg: (indexed '(a b c d)) => ([0 a] [1 b] [2 c] [3 d])

Return a lazy sequence of [index, item] pairs, where items come
from 'coll' and indexes count up from zero.
eg:
    (indexed '(a b c d))  =>  ([0 a] [1 b] [2 c] [3 d])
sourceraw docstring

invert-functionclj/s

(invert-function f domain-subset)
source

invert-relationclj/s

(invert-relation rel domain-subset)
source

last-index-of-char-in-stringclj/s

(last-index-of-char-in-string char string)
source

limiting-n-executionsclj/s

(limiting-n-executions limiter-id max-executions fun fun-when-too-many)

If we currently do not have too many concurrent executions, call fun. Otherwise call fun-when-too-many. Not having too many concurrent executions is defined like this:

  • consider the number of current executions of this function that share the supplied limiter-id
  • this number must be less than max-executions.
If we currently do not have too many concurrent executions, call `fun`.
Otherwise call `fun-when-too-many`.
Not having too many concurrent executions is defined like this:
- consider the number of current executions of this function that share the
  supplied `limiter-id`
- this number must be less than `max-executions`.
sourceraw docstring

map-keysclj/s

(map-keys f m)

Apply f to each of the keys of m.

Apply `f` to each of the keys of `m`.
sourceraw docstring

map-keys-recursivelyclj/s

(map-keys-recursively f x)

Walk x, applying f to the keys of any maps. Don't call f when the keys are themselves maps.

Walk `x`, applying `f` to the keys of any maps.
Don't call `f` when the keys are themselves maps.
sourceraw docstring

map-keys-recursively-applying-to-mapsclj/s

(map-keys-recursively-applying-to-maps f x)

Walk x, applying f to the keys of any maps. Call f when the keys are themselves maps.

Walk `x`, applying `f` to the keys of any maps.
Call `f` when the keys are themselves maps.
sourceraw docstring

map-kvclj/s

(map-kv f m)

Apply f to each of the entries of m. f takes two args, a key and a value.

Apply `f` to each of the entries of `m`. `f` takes two args, a key and
a value.
sourceraw docstring

map-kv-recursivelyclj/s

(map-kv-recursively f x)

Walk x, applying f to any map entries.

Walk `x`, applying `f` to any map entries.
sourceraw docstring

map-valsclj/s

(map-vals f m)

Apply f to each of the vals of m.

Apply `f` to each of the vals of `m`.
sourceraw docstring

map-vals-recursivelyclj/s

(map-vals-recursively f x)

Walk x, applying f to the vals of any maps. Don't call f when the keys are themselves maps.

Walk `x`, applying `f` to the vals of any maps.
Don't call `f` when the keys are themselves maps.
sourceraw docstring

map-vals-recursively-applying-to-mapsclj/s

(map-vals-recursively-applying-to-maps f x)

Walk x, applying f to the vals of any maps. Call f when the keys are themselves maps.

Walk `x`, applying `f` to the vals of any maps.
Call `f` when the keys are themselves maps.
sourceraw docstring

member?clj/s

(member? item coll)
source

my-errorclj/sdeprecated

(my-error cl-format-string & format-args)
source

only-onceclj/s

(only-once f)

f is a function of no args. Return a function that on its first invocation calls f, and on subsequent invocations does nothing and returns ::already-run. Unlike memoize, the function is called only once even if invoked from multiple threads at the same time.

`f` is a function of no args. Return a function that on its first
invocation calls `f`, and on subsequent invocations does nothing and
returns `::already-run`.
Unlike `memoize`, the function is called only once even if invoked from
multiple threads at the same time.
sourceraw docstring

positionclj/s

(position pred coll)

Return the index of the first item in 'coll' that satisfies 'pred', or nil if there is no such item.

Return the index of the first item in 'coll' that satisfies 'pred',
or nil if there is no such item.
sourceraw docstring

positionsclj/s

(positions pred coll)

Return a lazy sequence containing the positions at which pred is true for items in coll.

Return a lazy sequence containing the positions at which pred
is true for items in coll.
sourceraw docstring

select-keys-recursivelyclj/s

(select-keys-recursively m key-paths)

Similar to select-keys, but with key paths digging in to a nested map. key-paths is a sequence. Each element of key-paths begins with a key, k, to be selected and is followed by a vector of key paths that specify the things to be selected from the value corresponding to k. Example: (select-keys-recursively {:k-1 "v-1" :k-2 {:k-2-1 "v-2-1" :k-2-2 {:k-2-2-1 "v-2-2-1" :k-2-2-2 "v-2-2-2" :k-2-2-3 "v-2-2-3"}} :k-3 "v-3"} [[:k-1] [:k-2 [:k-2-2 [:k-2-2-1] [:k-2-2-3]]]]) => {:k-1 "v-1" :k-2 {:k-2-2 {:k-2-2-1 "v-2-2-1" :k-2-2-3 "v-2-2-3"}}}

Similar to `select-keys`, but with key paths digging in to a nested map.
`key-paths` is a sequence. Each element of `key-paths` begins with a key, k,
to be selected and is followed by a vector of key paths that specify the
things to be selected from the value corresponding to k.
Example:
    (select-keys-recursively {:k-1 "v-1"
                              :k-2 {:k-2-1 "v-2-1"
                                    :k-2-2 {:k-2-2-1 "v-2-2-1"
                                            :k-2-2-2 "v-2-2-2"
                                            :k-2-2-3 "v-2-2-3"}}
                              :k-3 "v-3"}
                             [[:k-1]
                              [:k-2 [:k-2-2
                                      [:k-2-2-1]
                                      [:k-2-2-3]]]])
    => {:k-1 "v-1"
        :k-2 {:k-2-2 {:k-2-2-1 "v-2-2-1"
                      :k-2-2-3 "v-2-2-3"}}}
sourceraw docstring

submap?clj/s

(submap? m1 m2)
source

submap?-v2clj/s

(submap?-v2 m1 m2)
source

transitive-closureclj/s

(transitive-closure f v)

The set of values obtained by starting with v, then applying f to v, then applying f to each of the results, and so on. v and all intermediate values are included in the result.

The set of values obtained by starting with v, then applying f to v,
then applying f to each of the results, and so on. v and all
intermediate values are included in the result.
sourceraw docstring

transitive-closure-excluding-selfclj/s

(transitive-closure-excluding-self f v)

The set of values obtained by applying f to v, then applying f to each of the results, and so on. All intermediate values are included in the result.

The set of values obtained by applying f to v,
then applying f to each of the results, and so on. All
intermediate values are included in the result.
sourceraw docstring

unchunkclj/s

(unchunk s)

Produce a fully-lazy sequence from s. Sometimes Clojure sequences are not fully lazy. See http://blog.fogus.me/2010/01/22/de-chunkifying-sequences-in-clojure/ for details. See also Stuart Sierra comment at https://stackoverflow.com/questions/3407876/how-do-i-avoid-clojures-chunking-behavior-for-lazy-seqs-that-i-want-to-short-ci

Produce a fully-lazy sequence from `s`.
Sometimes Clojure sequences are not fully lazy.
See http://blog.fogus.me/2010/01/22/de-chunkifying-sequences-in-clojure/
for details.
See also Stuart Sierra comment at https://stackoverflow.com/questions/3407876/how-do-i-avoid-clojures-chunking-behavior-for-lazy-seqs-that-i-want-to-short-ci
sourceraw docstring

with-extrasclj/smacro

(with-extras {:keys [before after finally]} & body)

Does before, then body, then after. Returns the result of body. Within after, the result of body is available as %result%. In the event of a non-local exit, the value of %result% is ::non-local-exit.

Does `before`, then `body`, then `after`. Returns the result of `body`.
Within `after`, the result of `body` is available as `%result%`. In
the event of a non-local exit, the value of `%result%` is
`::non-local-exit`.
sourceraw docstring

with-return-429-if-too-many-requestsclj/smacro

(with-return-429-if-too-many-requests options & body)

Macro wrapper for fun-with-return-429-if-too-many-requests.

Macro wrapper for `fun-with-return-429-if-too-many-requests`.
sourceraw docstring

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

× close