Extended core library for Clojure/Script that emphasizes:
This lib's mostly for my own use and for advanced users that feel comfortable reading this source. Not providing much beginner-oriented documentation for this, sorry.
Quick Taoensso naming conventions:
foo - Dynamic var
foo! - Fn with side effects, or that should otherwise be used cautiously
foo? - Truthy val or fn that returns truthy val
foo!? - Fn that has side effects (or requires caution) and that return
a truthy val. Note: !?, not ?!
foo$ - Fn that's notably expensive to compute (e.g. hits db)
foo_ - Dereffable val (e.g. atom, volatile, delay, etc.)
foo__ - Dereffable in a dereffable (e.g. delay in an atom), etc.
_ - Unnamed val
_foo - Named but unused val
?foo - Optional val (emphasize that val may be nil)
foo* - A variation of foo
(e.g. foo*
macro vs foo
fn)
foo' - ''
-foo - Public implementation detail or intermediate (e.g. uncoerced) val
foo - Val "to foo" (e.g. >sender, >host), or fn to put/coerce/transform <foo - Val "from foo" (e.g. <sender, <host), or fn to take/coerce/transform ->foo - Fn to put/coerce/transform
Commit message tags (in priority order): [mod] - Modify behaviour (=> breaking), [mod!], [mod!!], etc. for attention [fix] - Fix broken behaviour (=> usu. non-breaking) [new] - Add new behaviour (=> non-breaking) [nop] - Unmodified behaviour (=> non-breaking implementation or non-code changes, etc.) [x,y] - Single commit with multiple tags (in priority order), try avoid
Extended core library for Clojure/Script that emphasizes: * Cross platform API compatibility * Flexibility * Performance * Backwards compatibility This lib's mostly for my own use and for advanced users that feel comfortable reading this source. Not providing much beginner-oriented documentation for this, sorry. Quick Taoensso naming conventions: **foo** - Dynamic var foo! - Fn with side effects, or that should otherwise be used cautiously foo? - Truthy val or fn that returns truthy val foo!? - Fn that has side effects (or requires caution) and that return a truthy val. Note: !?, not ?! foo$ - Fn that's notably expensive to compute (e.g. hits db) foo_ - Dereffable val (e.g. atom, volatile, delay, etc.) foo__ - Dereffable in a dereffable (e.g. delay in an atom), etc. _ - Unnamed val _foo - Named but unused val ?foo - Optional val (emphasize that val may be nil) foo* - A variation of `foo` (e.g. `foo*` macro vs `foo` fn) foo' - '' -foo - Public implementation detail or intermediate (e.g. uncoerced) val >foo - Val "to foo" (e.g. >sender, >host), or fn to put/coerce/transform <foo - Val "from foo" (e.g. <sender, <host), or fn to take/coerce/transform ->foo - Fn to put/coerce/transform Commit message tags (in priority order): [mod] - Modify behaviour (=> breaking), [mod!], [mod!!], etc. for attention [fix] - Fix broken behaviour (=> usu. non-breaking) [new] - Add new behaviour (=> non-breaking) [nop] - Unmodified behaviour (=> non-breaking implementation or non-code changes, etc.) [x,y] - Single commit with multiple tags (in priority order), try avoid
(->?singleton coll)
(->vec x)
(-alias-meta src-var)
(-as-throw as-name x)
(-assert-unstub-val s)
(-assert-unstub-val f)
(-cond throw? & clauses)
(-gc-now?)
(-if-cas! atom_ old-val new-val then & [?else])
Micro optimization, mostly for cljs.
Micro optimization, mostly for cljs.
(-intern-stub ns stub-sym stub-var src)
(-link-var dst src)
(-matching-throwable ex)
(-matching-throwable c ex)
(-matching-throwable c pattern ex)
(-merge-with nest? f maps)
(-new-stubfn_ name)
(-swap-val! atom_ k f)
Used internally by memoization utils.
Used internally by memoization utils.
(-vol! val)
(-vol-reset! vol_ val)
(-vol-swap! vol_ f & args)
(<* x y z)
(<=* x y z)
(>* x y z)
(>=* x y z)
(abs n)
(after-timeout msecs & body)
Alpha, subject to change. Returns a TimeoutFuture that will execute body after timeout. Body must be non-blocking or cheap.
Alpha, subject to change. Returns a TimeoutFuture that will execute body after timeout. Body must be non-blocking or cheap.
(ajax-lite uri
{:keys [method params headers timeout-ms resp-type with-credentials?]
:as opts
:or {method :get timeout-ms 10000 resp-type :auto}}
callback-fn)
Alpha, subject to change. Simple, lightweight Ajax via Google Closure. Returns the resulting XhrIo[1] instance, or nil.
(ajax-lite "/my-post-route" {:method :post :params {:username "Rich Hickey" :type "Awesome"} :headers {"Foo" "Bar"} :resp-type :text :timeout-ms 7000 :with-credentials? false ; Enable if using CORS (requires xhr v2+) } (fn async-callback-fn [resp-map] (let [{:keys [success? ?status ?error ?content ?content-type]} resp-map] ;; ?status - e/o #{nil 200 404 ...}, non-nil iff server responded ;; ?error - e/o #{nil <http-error-status-code> <exception> :timeout :abort :http-error :exception :xhr-pool-depleted} (js/alert (str "Ajax response: " resp-map)))))
[1] Ref. https://developers.google.com/closure/library/docs/xhrio
Alpha, subject to change. Simple, lightweight Ajax via Google Closure. Returns the resulting XhrIo[1] instance, or nil. (ajax-lite "/my-post-route" {:method :post :params {:username "Rich Hickey" :type "Awesome"} :headers {"Foo" "Bar"} :resp-type :text :timeout-ms 7000 :with-credentials? false ; Enable if using CORS (requires xhr v2+) } (fn async-callback-fn [resp-map] (let [{:keys [success? ?status ?error ?content ?content-type]} resp-map] ;; ?status - e/o #{nil 200 404 ...}, non-nil iff server responded ;; ?error - e/o #{nil <http-error-status-code> <exception> :timeout :abort :http-error :exception :xhr-pool-depleted} (js/alert (str "Ajax response: " resp-map))))) [1] Ref. https://developers.google.com/closure/library/docs/xhrio
(approx= x y)
(approx= x y signf)
(approx== x y)
(approx== signf x y)
(as-?bool x)
(as-?email ?s)
(as-?email max-len ?s)
(as-?float x)
(as-?int x)
(as-?kw x)
(as-?name x)
(as-?nat-float x)
(as-?nat-int x)
(as-?nblank x)
(as-?nblank-trim x)
(as-?nemail ?s)
(as-?nemail max-len ?s)
(as-?nempty-str x)
(as-?nzero x)
(as-?pnum x)
(as-?pos-float x)
(as-?pos-int x)
(as-?qname x)
(as-?rnum x)
(as-?udt x)
(as-bool x)
(as-email x)
(as-email n x)
(as-float x)
(as-int x)
(as-kw x)
(as-map kvs & [kf vf])
Deprecated, prefer reduce-kvs
Deprecated, prefer `reduce-kvs`
(as-name x)
(as-nat-float x)
(as-nat-int x)
(as-nblank x)
(as-nblank-trim x)
(as-nemail x)
(as-nemail n x)
(as-nempty-str x)
(as-nzero x)
(as-pnum x)
(as-pnum-complement x)
(as-pos-float x)
(as-pos-int x)
(as-qname x)
(as-rnum x)
(as-udt x)
(assert-min-encore-version min-version)
Version check for dependency conflicts, etc.
Version check for dependency conflicts, etc.
(assoc-nx m kvs)
(assoc-nx m k v)
(assoc-nx m k v & kvs)
Assocs each kv iff its key doesn't already exist.
Assocs each kv iff its key doesn't already exist.
(assoc-some m kvs)
(assoc-some m k v)
(assoc-some m k v & kvs)
Assocs each kv iff its value is not nil.
Assocs each kv iff its value is not nil.
(assoc-when m kvs)
(assoc-when m k v)
(assoc-when m k v & kvs)
Assocs each kv iff its val is truthy.
Assocs each kv iff its val is truthy.
(atom? x)
(ba-concat ba1 ba2)
(ba-split ba idx)
(ba= x y)
(bench nlaps opts & body)
(bench* nlaps
{:keys [nlaps-warmup nthreads as-ns?] :or {nlaps-warmup 0 nthreads 1}}
f)
Repeatedly executes fn and returns time taken to complete execution.
Repeatedly executes fn and returns time taken to complete execution.
(boolean? x)
(bytes? x)
(call-after-timeout msecs f)
(call-after-timeout impl_ msecs f)
Alpha, subject to change.
Returns a TimeoutFuture that will execute f
after given msecs.
Does NOT do any automatic binding conveyance.
Performance depends on the provided timer implementation (impl_
).
The default implementation offers O(logn) add, O(1) cancel, O(1) tick.
See ITimeoutImpl
for extending to arbitrary timer implementations.
Alpha, subject to change. Returns a TimeoutFuture that will execute `f` after given msecs. Does NOT do any automatic binding conveyance. Performance depends on the provided timer implementation (`impl_`). The default implementation offers O(logn) add, O(1) cancel, O(1) tick. See `ITimeoutImpl` for extending to arbitrary timer implementations.
(case-eval expr & clauses)
Like case
but evals test constants for their compile-time value.
Like `case` but evals test constants for their compile-time value.
(catch-errors & body)
(catch-errors* & args)
(catching try-expr)
(catching try-expr error-sym catch-expr)
(catching try-expr error-sym catch-expr finally-expr)
Cross-platform try/catch/finally.
Cross-platform try/catch/finally.
(caught-error-data & body)
Handy for error-throwing unit tests.
Handy for error-throwing unit tests.
(chan? x)
(chance p)
(check-all test)
(check-all test & more)
Returns all logical false/throwing expressions (ids/forms), or nil.
Returns all logical false/throwing expressions (ids/forms), or nil.
(check-some test)
(check-some test & more)
Returns first logical false/throwing expression (id/form), or nil.
Returns first logical false/throwing expression (id/form), or nil.
(clamp nmin nmax n)
(clamp* nmin nmax n)
(clamp-float nmin nmax n)
(clamp-int nmin nmax n)
(compile-if test then)
(compile-if test then else)
Evaluates test
. If it returns logical true (and doesn't throw), expands
to then
, otherwise expands to else
.
Evaluates `test`. If it returns logical true (and doesn't throw), expands to `then`, otherwise expands to `else`.
(compile-ns-filter ns-pattern)
(compile-ns-filter whitelist blacklist)
Deprecated, prefer compile-str-filter
instead.
Deprecated, prefer `compile-str-filter` instead.
(compile-str-filter spec)
Compiles given spec and returns a fast (fn conform? [?in-str]).
Spec may be:
A regex pattern. Will conform on match.
A string, in which any ""s will act as wildcards (#"."). Will conform on match.
A vector or set of regex patterns or strings. Will conform on ANY match. If you need literal "*"s, use an explicit regex pattern instead.
{:allow <allow-spec> :deny <deny-spec> :cache? <bool>}. Will conform iff allow-spec matches AND deny-spec does NOT.
Input may be: namespace strings, class names, etc. Useful as string allowlist (whitelist) and/or denylist (blacklist).
Spec examples: #{}, "", "foo.bar", "foo.bar.", #{"foo" "bar."}, {:allow #{"foo" "bar."} :deny #{"foo..bar."}}
Compiles given spec and returns a fast (fn conform? [?in-str]). Spec may be: - A regex pattern. Will conform on match. - A string, in which any "*"s will act as wildcards (#".*"). Will conform on match. - A vector or set of regex patterns or strings. Will conform on ANY match. If you need literal "*"s, use an explicit regex pattern instead. - {:allow <allow-spec> :deny <deny-spec> :cache? <bool>}. Will conform iff allow-spec matches AND deny-spec does NOT. Input may be: namespace strings, class names, etc. Useful as string allowlist (whitelist) and/or denylist (blacklist). Spec examples: #{}, "*", "foo.bar", "foo.bar.*", #{"foo" "bar.*"}, {:allow #{"foo" "bar.*"} :deny #{"foo.*.bar.*"}}
(compile-when test & body)
(compiling-cljs?)
Return truthy iff currently generating Cljs code.
Return truthy iff currently generating Cljs code.
(cond & clauses)
Like core/cond
but supports implicit final else
clause, and special
clause keywords for advanced behaviour:
(cond :let [x "x"] ; Establish let binding/s for remaining forms :binding [x "x"] ; Establish dynamic binding/s for remaining forms :do (println (str "x value: " x)) ; Eval expr for side effects
:if-let [y "y" z nil] "y and z were both truthy"
:if-some [y "y" z nil] "y and z were both non-nil")
:let support inspired by https://github.com/Engelberg/better-cond. Simple, flexible way to eliminate deeply-nested control flow code.
Like `core/cond` but supports implicit final `else` clause, and special clause keywords for advanced behaviour: (cond :let [x "x"] ; Establish let binding/s for remaining forms :binding [*x* "x"] ; Establish dynamic binding/s for remaining forms :do (println (str "x value: " x)) ; Eval expr for side effects :if-let [y "y" z nil] "y and z were both truthy" :if-some [y "y" z nil] "y and z were both non-nil") :let support inspired by https://github.com/Engelberg/better-cond. Simple, flexible way to eliminate deeply-nested control flow code.
(cond! & clauses)
Like cond
but throws on non-match like case
and condp
.
Like `cond` but throws on non-match like `case` and `condp`.
(cond* & args)
(cond-throw & args)
(conj-some)
(conj-some coll)
(conj-some coll x)
(conj-some coll x & more)
Conjoins each non-nil value.
Conjoins each non-nil value.
(conj-when)
(conj-when coll)
(conj-when coll x)
(conj-when coll x & more)
Conjoins each truthy value.
Conjoins each truthy value.
(const-ba= ba1 ba2)
Constant-time ba=
.
Useful to prevent timing attacks, etc.
Constant-time `ba=`. Useful to prevent timing attacks, etc.
(const-str= s1 s2)
Constant-time string equality checker. Useful to prevent timing attacks, etc.
Constant-time string equality checker. Useful to prevent timing attacks, etc.
(contains-in? coll ks)
(contains-in? coll ks k)
(convey-reduced x)
(count-words s)
(counter)
(counter init)
Returns a fast atomic Counter with init
initial int value:
Experimental 3-arity version takes an action
:
:add, :set, :set-get, :get-set, :get-add, :add-get
Returns a fast atomic Counter with `init` initial int value: - (<counter> ) -> add 1, return old val - (<counter> <n>) -> add n, return old val Experimental 3-arity version takes an `action`: :add, :set, :set-get, :get-set, :get-add, :add-get
(debugf fmt & xs)
(declare-remote & syms)
Declares given ns-qualified symbols, preserving metadata. Useful for circular dependencies.
Declares given ns-qualified symbols, preserving metadata. Useful for circular dependencies.
(defalias src)
(defalias sym src)
(defalias sym src attrs)
Defines an alias for qualified source symbol, preserving its metadata (clj only): (defalias my-map-alias clojure.core/map)
Cannot alias Cljs macros. Changes to source are not automatically applied to alias.
Defines an alias for qualified source symbol, preserving its metadata (clj only): (defalias my-map-alias clojure.core/map) Cannot alias Cljs macros. Changes to source are not automatically applied to alias.
Simple one-timeout timeout implementation provided by platform timer. O(logn) add, O(1) cancel, O(1) tick. Fns must be non-blocking or cheap. Similar efficiency to core.async timers (binary heap vs DelayQueue).
Simple one-timeout timeout implementation provided by platform timer. O(logn) add, O(1) cancel, O(1) tick. Fns must be non-blocking or cheap. Similar efficiency to core.async timers (binary heap vs DelayQueue).
(defonce sym & args)
Like core/defonce
but supports optional docstring and attrs map.
Like `core/defonce` but supports optional docstring and attrs map.
(defonce* & args)
(defstub sym)
Experimental. Declares a stub var that can be initialized from any
namespace with unstub-<stub-name>
. Decouples a var's declaration
(location) and its initialization (value). Handy for defining vars in a
shared ns from elsewhere (e.g. a private or cyclic ns).
Experimental. Declares a stub var that can be initialized from any namespace with `unstub-<stub-name>`. Decouples a var's declaration (location) and its initialization (value). Handy for defining vars in a shared ns from elsewhere (e.g. a private or cyclic ns).
(deprecated & body)
Elides body when taoensso.elide-deprecated
JVM property or
TAOENSSO_ELIDE_DEPRECATED
environment variable is e/o #{"true" "TRUE"}.
Elides body when `taoensso.elide-deprecated` JVM property or `TAOENSSO_ELIDE_DEPRECATED` environment variable is e/o #{"true" "TRUE"}.
(derefable? x)
(dis-assoc-some m kvs)
(dis-assoc-some m k v)
(dis-assoc-some m k v & kvs)
Assocs each kv if its value is not nil, otherwise dissocs it.
Assocs each kv if its value is not nil, otherwise dissocs it.
(dissoc-in m ks)
(dissoc-in m ks dissoc-k)
(dissoc-in m ks dissoc-k & more)
(distinct-by keyfn coll)
Deprecated, prefer xdistinct
Deprecated, prefer `xdistinct`
(distinct-elements? x)
(distinctv coll)
(distinctv keyfn coll)
Deprecated, prefer xdistinct
Deprecated, prefer `xdistinct`
(do-false & body)
(do-nil & body)
(do-true & body)
(doto-cond [sym x] & clauses)
Cross between doto
, cond->
and as->
.
Cross between `doto`, `cond->` and `as->`.
(editable? x)
(ensure-set x)
(ensure-vec x)
(error-data x)
Returns data map iff x
is an error of any type on platform.
Returns data map iff `x` is an error of any type on platform.
(error? x)
(errorf fmt & xs)
(exception? x)
(exp-backoff n-attempt)
(exp-backoff n-attempt {:keys [min max factor] :or {factor 1000}})
Returns binary exponential backoff value for n<=36.
Returns binary exponential backoff value for n<=36.
(explode-keyword k)
(fatalf fmt & xs)
Returns true iff any files backing the given named resources have changed since last call.
Returns true iff any files backing the given named resources have changed since last call.
(filter-keys pred m)
(filter-kvs pred m)
(filter-vals pred m)
(finite-num? x)
Returns true iff given a standard finite number (excl. NaN and infinities).
Returns true iff given a standard finite number (excl. NaN and infinities).
(float? x)
Returns true iff given a standard fixed-precision floating-point.
Returns true iff given a standard fixed-precision floating-point.
(fmemoize f)
For Clj: fastest possible memoize. Non-racey, 0-3 arity only.
For Cljs: just passes through to core/memoize
.
For Clj: fastest possible memoize. Non-racey, 0-3 arity only. For Cljs: just passes through to `core/memoize`.
(format fmt & args)
Like core/format
but:
format
!).Like `core/format` but: * Returns "" when fmt is nil rather than throwing an NPE. * Formats nil as "nil" rather than "null". * Provides ClojureScript support via goog.string.format (this has fewer formatting options than Clojure's `format`!).
(format* fmt args)
(format-query-string m)
(future-pool n)
Returns a simple semaphore-limited wrapper of Clojure's standard future
:
(fn
[f] - Blocks to acquire a future, then executes (f) on that future.
[ ] - Blocks to acquire all futures, then immediately releases them.
Useful for blocking till all outstanding work completes.
Timeout variants are also provided.
Returns a simple semaphore-limited wrapper of Clojure's standard `future`: (fn [f] - Blocks to acquire a future, then executes (f) on that future. [ ] - Blocks to acquire all futures, then immediately releases them. Useful for blocking till all outstanding work completes. Timeout variants are also provided.
(fzipmap ks vs)
(get-dynamic-assertion-data)
Returns current value of dynamic assertion data.
Returns current value of dynamic assertion data.
(get-env)
(get-file-resource-?last-modified rname)
Returns last-modified time for file backing given named resource, or nil if file doesn't exist.
Returns last-modified time for file backing given named resource, or nil if file doesn't exist.
(get-hostname)
Returns local hostname string, or nil.
Returns local hostname string, or nil.
(get-pom-version dep-sym)
Returns POM version string for given Maven dependency, or nil.
Returns POM version string for given Maven dependency, or nil.
(get-substr s start)
(get-substr s start end)
Like subs
but provides consistent clj/s behaviour and never throws
(snaps to valid start and end indexes).
Like `subs` but provides consistent clj/s behaviour and never throws (snaps to valid start and end indexes).
(get-substring s start)
(get-substring s start length)
Like get-substr
but:
length
instead of end
(index).start
=> index from right of string.Like `get-substr` but: - Takes `length` instead of `end` (index). - -ive `start` => index from right of string.
(get-subvec v start)
(get-subvec v start end)
Like subvec
but never throws (snaps to valid start and end indexes).
Like `subvec` but never throws (snaps to valid start and end indexes).
(get-subvector v start)
(get-subvector v start length)
Like get-subvec
but:
length
instead of end
(index).start
=> index from right of vector.Like `get-subvec` but: - Takes `length` instead of `end` (index). - -ive `start` => index from right of vector.
(get-sys-bool default prop-id env-id)
If prop-id
JVM property or env-id
environment variable are set:
true
if set value is e/o #{"1" "t" "true" "T" "TRUE"}false
if set value is e/o #{"0" "f" "false""F" "FALSE"}Returns default
if neither property nor environment variable is set.
If `prop-id` JVM property or `env-id` environment variable are set: - Returns `true` if set value is e/o #{"1" "t" "true" "T" "TRUE"} - Returns `false` if set value is e/o #{"0" "f" "false""F" "FALSE"} - Otherwise throws Returns `default` if neither property nor environment variable is set.
(get-sys-val id)
(get-sys-val prop-id env-id)
(get-win-loc)
Returns js/window
's current location as a map.
Returns `js/window`'s current location as a map.
(greatest coll & [?comparator])
(have pred (:in) x)
(have pred (:in) x & more-xs)
Takes a pred and one or more vals. Tests pred against each val, trapping errors. If any pred test fails, throws a detailed assertion error. Otherwise returns input val/vals for convenient inline-use/binding.
Respects assert value so tests can be elided from production for zero runtime costs.
Provides a small, simple, flexible feature subset to alternative tools like clojure.spec, core.typed, prismatic/schema, etc.
;; Will throw a detailed error message on invariant violation: (fn my-fn [x] (str/trim (have string? x)))
You may attach arbitrary debug info to assertion violations like:
(have string? x :data {:my-arbitrary-debug-info "foo"})
See also have?
, have!
.
Takes a pred and one or more vals. Tests pred against each val, trapping errors. If any pred test fails, throws a detailed assertion error. Otherwise returns input val/vals for convenient inline-use/binding. Respects *assert* value so tests can be elided from production for zero runtime costs. Provides a small, simple, flexible feature subset to alternative tools like clojure.spec, core.typed, prismatic/schema, etc. ;; Will throw a detailed error message on invariant violation: (fn my-fn [x] (str/trim (have string? x))) You may attach arbitrary debug info to assertion violations like: `(have string? x :data {:my-arbitrary-debug-info "foo"})` See also `have?`, `have!`.
(have & args)
(have! pred (:in) x)
(have! pred (:in) x & more-xs)
Like have
but ignores assert value (so can never be elided). Useful
for important conditions in production (e.g. security checks).
Like `have` but ignores *assert* value (so can never be elided). Useful for important conditions in production (e.g. security checks).
(have!? pred (:in) x)
(have!? pred (:in) x & more-xs)
Specialized cross between have?
and have!
. Not used often but can be
handy for semantic clarification and/or to improve multi-val performance
when the return vals aren't necessary.
WARNING: Do NOT use in :pre/:post conds since those are ALWAYS subject
to assert, directly contradicting the intention of the bang (!
) here.
Specialized cross between `have?` and `have!`. Not used often but can be handy for semantic clarification and/or to improve multi-val performance when the return vals aren't necessary. **WARNING**: Do NOT use in :pre/:post conds since those are ALWAYS subject to *assert*, directly contradicting the intention of the bang (`!`) here.
(have-in a1 & an)
(have-in! a1 & an)
(have? pred (:in) x)
(have? pred (:in) x & more-xs)
Like have
but returns true
on successful tests. In particular, this
can be handy for use with :pre/:post conditions. Compare:
(fn my-fn [x] {:post [(have nil? %)]} nil) ; {:post [nil]} FAILS
(fn my-fn [x] {:post [(have? nil? %)]} nil) ; {:post [true]} passes as intended
Like `have` but returns `true` on successful tests. In particular, this can be handy for use with :pre/:post conditions. Compare: (fn my-fn [x] {:post [(have nil? %)]} nil) ; {:post [nil]} FAILS (fn my-fn [x] {:post [(have? nil? %)]} nil) ; {:post [true]} passes as intended
(have? & args)
(ident? x)
(if-clj then & [else])
(if-cljs then & [else])
(if-let bindings then)
(if-let bindings then else)
Like core/if-let
but can bind multiple values for then
iff all tests
are truthy, supports internal unconditional :let
s.
Like `core/if-let` but can bind multiple values for `then` iff all tests are truthy, supports internal unconditional `:let`s.
(if-lets & args)
(if-not test-or-bindings then)
(if-not test-or-bindings then else)
Like core/if-not
but acts like if-let
when given a binding vector
as test expr.
Like `core/if-not` but acts like `if-let` when given a binding vector as test expr.
(if-not* & args)
(if-some bindings then)
(if-some bindings then else)
Like core/if-some
but can bind multiple values for then
iff all tests
are non-nil, supports internal unconditional :let
s.
Like `core/if-some` but can bind multiple values for `then` iff all tests are non-nil, supports internal unconditional `:let`s.
(indexed? x)
(infof fmt & xs)
(int? x)
Returns true iff given a standard fixed-precision integer.
Returns true iff given a standard fixed-precision integer.
(interleave-all)
(interleave-all c1)
(interleave-all c1 c2)
(interleave-all c1 c2 & colls)
Greedy version of interleave
.
Greedy version of `interleave`.
(interns-overview)
(interns-overview ns)
Returns {:keys [public private impl test]}, with each key mapped to an alphabetical list of the relevant vars in given namespace.
"impl" vars are public vars with names that begin with "-" or "_", a naming convention commonly used to indicate vars intended to be treated as private implementation details even when public.
Returns {:keys [public private impl test]}, with each key mapped to an alphabetical list of the relevant vars in given namespace. "impl" vars are public vars with names that begin with "-" or "_", a naming convention commonly used to indicate vars intended to be treated as private implementation details even when public.
(into! to from)
(into! to xform from)
(into-all to from)
(into-all to from & more)
Like into
but supports multiple "from"s.
Like `into` but supports multiple "from"s.
(into-str & xs)
Simple Hiccup-like string templating to complement Tempura.
Simple Hiccup-like string templating to complement Tempura.
(invert-map m)
(is! x)
(is! pred x)
(is! pred x fail-?data)
Cheaper have!
that provides less diagnostic info.
Cheaper `have!` that provides less diagnostic info.
(tf-cancel! _)
Returns true iff the timeout was successfully cancelled (i.e. was previously pending).
Returns true iff the timeout was successfully cancelled (i.e. was previously pending).
(tf-cancelled? _)
Returns true iff the timeout is cancelled.
Returns true iff the timeout is cancelled.
(tf-done? _)
Returns true iff the timeout is not pending (i.e. has a completed result or is cancelled).
Returns true iff the timeout is not pending (i.e. has a completed result or is cancelled).
(tf-pending? _)
Returns true iff the timeout is pending.
Returns true iff the timeout is pending.
(tf-poll _)
Returns :timeout/pending, :timeout/cancelled, or the timeout's completed result.
Returns :timeout/pending, :timeout/cancelled, or the timeout's completed result.
(tf-state _)
Returns a map of timeout's public state.
Returns a map of timeout's public state.
(-schedule-timeout _ msecs f)
(join-once sep & coll)
(keys-by f coll)
Returns {(f x) x} map for xs in coll
.
Returns {(f x) x} map for xs in `coll`.
(keys<= m ks)
(keys= m ks)
(keys=nnil? m ks)
(keys>= m ks)
(keywordize-map m)
(ks-nnil? ks m)
(ks<= ks m)
(ks= ks m)
(ks>= ks m)
(kw-identical? x y)
Tests if 2 arguments are the same object
Tests if 2 arguments are the same object
(lazy-seq? x)
(least coll & [?comparator])
(limiter specs)
Takes {<spec-id> [<n-max-reqs> <msecs-window>]}, and returns a rate limiter (fn check-limits! [req-id]) -> nil (all limits pass), or [<worst-spec-id> <worst-backoff-msecs> {<spec-id> <backoff-msecs>}].
Limiter fn commands: :rl/peek <req-id> - Check limits w/o side effects. :rl/reset <req-id> - Reset all limits for given req-id.
Takes {<spec-id> [<n-max-reqs> <msecs-window>]}, and returns a rate limiter (fn check-limits! [req-id]) -> nil (all limits pass), or [<worst-spec-id> <worst-backoff-msecs> {<spec-id> <backoff-msecs>}]. Limiter fn commands: :rl/peek <req-id> - Check limits w/o side effects. :rl/reset <req-id> - Reset all limits for given req-id.
(limiter* specs)
Experimental. Like limiter
but returns [<limiter> <state_>].
Experimental. Like `limiter` but returns [<limiter> <state_>].
(logf fmt & xs)
(logp & xs)
(map-keys f m)
(map-kvs kf vf m)
Deprecated, prefer reduce-kv
Deprecated, prefer `reduce-kv`
(map-vals f m)
(mapply f & args)
Like apply
but calls seq-kvs
on final arg.
Like `apply` but calls `seq-kvs` on final arg.
(max* n1 n2)
(memoize f)
(memoize ttl-ms f)
(memoize cache-size ttl-ms f)
Like core/memoize
but:
ttl-ms
opt.cache-size
opt.:mem/del
or :mem/fresh
.Like `core/memoize` but: - Often faster, depending on opts. - Prevents race conditions on writes. - Supports auto invalidation & gc with `ttl-ms` opt. - Supports cache size limit & gc with `cache-size` opt. - Supports invalidation by prepending args with `:mem/del` or `:mem/fresh`.
(memoize-last f)
Like core/memoize
but only caches the fn's most recent call.
Great for Reactjs render op caching on mobile devices, etc.
Like `core/memoize` but only caches the fn's most recent call. Great for Reactjs render op caching on mobile devices, etc.
(memoized cache f & args)
(merge & maps)
Like core/merge
but faster, supports :swap/dissoc
rvals.
Like `core/merge` but faster, supports `:swap/dissoc` rvals.
(merge-headers rresp headers)
(merge-keywords ks)
(merge-keywords ks omit-slash?)
(merge-meta x m)
(merge-url-with-query-string url m)
(merge-with f & maps)
Like core/merge-with
but faster, supports :swap/dissoc
rvals.
Like `core/merge-with` but faster, supports `:swap/dissoc` rvals.
(min* n1 n2)
(ms & {:as opts :keys [years months weeks days hours mins secs msecs ms]})
Returns ~number of milliseconds in period defined by given args.
Returns ~number of milliseconds in period defined by given args.
(ms->secs ms)
(name-with-attrs sym args)
(name-with-attrs sym args attrs-merge)
Given a symbol and args, returns [<name-with-attrs-meta> <args>] with
support for defn
style ?docstring
and ?attrs-map
.
Given a symbol and args, returns [<name-with-attrs-meta> <args>] with support for `defn` style `?docstring` and `?attrs-map`.
(named? x)
(nano-time* & args)
(nanoid)
(nanoid len)
Experimental. Optimized variant of secure-rand-id
that returns Nano IDs
as in https://github.com/ai/nanoid.
Experimental. Optimized variant of `secure-rand-id` that returns Nano IDs as in https://github.com/ai/nanoid.
(nat-float? x)
(nat-int? x)
(nat-num? x)
(nblank-str? x)
(nblank? x)
(neg-float? x)
(neg-int? x)
(neg-num? x)
(nempty-str? x)
(nested-merge & maps)
Like merge
but does nested merging.
Like `merge` but does nested merging.
(nested-merge-with f & maps)
Like merge-with
but does nested merging.
Like `merge-with` but does nested merging.
(new-object)
(nil->sentinel x)
(nneg? x)
(nnil)
(nnil x)
(nnil x y)
(nnil x y z)
(nnil x y z & more)
Returns first non-nil arg, or nil.
Returns first non-nil arg, or nil.
(nnil-set x)
(node-paths m)
(node-paths node-pred m)
(node-paths node-pred m basis)
(norm-str s)
(norm-str form s)
Given a Unicode string, returns the normalized de/composed form. It's often a good idea to normalize strings before exchange or storage, especially if you're going to be querying against those string.
form
is e/o #{:nfc :nfkc :nfd :nfkd <java.text.NormalizerForm>}.
Defaults to :nfc as per W3C recommendation.
Given a Unicode string, returns the normalized de/composed form. It's often a good idea to normalize strings before exchange or storage, especially if you're going to be querying against those string. `form` is e/o #{:nfc :nfkc :nfd :nfkd <java.text.NormalizerForm>}. Defaults to :nfc as per W3C recommendation.
(norm-word-breaks s)
Converts all word breaks of any form and length (including line breaks of any form, tabs, spaces, etc.) to a single regular space.
Converts all word breaks of any form and length (including line breaks of any form, tabs, spaces, etc.) to a single regular space.
(normalize-headers rreq-or-rresp)
(now-dt)
(now-dt*)
(now-nano)
Uses window context as epoch, Ref. http://goo.gl/mWZWnR
Uses window context as epoch, Ref. http://goo.gl/mWZWnR
(now-nano*)
(now-udt)
(now-udt*)
(nvec? n x)
(nzero-num? x)
(oget k)
(oget o k)
(oget o k not-found)
Like get
for JS objects.
Like `get` for JS objects.
(oget-in ks)
(oget-in o ks)
(oget-in o ks not-found)
Like get-in
for JS objects.
Like `get-in` for JS objects.
(oset-in o ks v)
Experimental. Like assoc-in
for JS objects.
Experimental. Like `assoc-in` for JS objects.
(parse-query-params s & [keywordize? encoding])
Based on ring-codec/form-decode
.
Based on `ring-codec/form-decode`.
(parse-version x)
(path & parts)
(perc n divisor)
(pnum-complement pnum)
(pnum? x)
Returns true iff given number in unsigned unit proportion interval ∈ℝ[0,1].
Returns true iff given number in unsigned unit proportion interval ∈ℝ[0,1].
(pos-float? x)
(pos-int? x)
(pos-num? x)
(pow n exp)
(pr-edn x)
(pr-edn _opts x)
Prints arg to an edn string readable with read-edn
.
Prints arg to an edn string readable with `read-edn`.
(preserve-reduced rf)
As core/preserving-reduced
.
As `core/preserving-reduced`.
(pull-val! atom_ k)
(pull-val! atom_ k not-found)
Removes and returns value mapped to key.
Removes and returns value mapped to key.
(qb & args)
(qbench & args)
(qualified-ident? x)
(qualified-keyword? x)
(qualified-symbol? x)
(queue* & items)
(queue? x)
(quick-bench nlaps form)
(quick-bench nlaps form & more)
Returns fastest of 3 sets of times for each form, in msecs.
Returns fastest of 3 sets of times for each form, in msecs.
(rate-limit specs f)
(rate-limited ncalls-limit window-ms f)
(rate-limiter ncalls-limit window-ms)
(rate-limiter* specs)
Deprecated, prefer limiter
Deprecated, prefer `limiter`
(re-pattern? x)
(read-edn s)
(read-edn opts s)
Attempts to pave over differences in:
clojure.edn/read-string
, clojure.tools.edn/read-string
,
cljs.reader/read-string
, cljs.tools.reader/read-string
.
cljs.reader
in particular can be a pain.
Attempts to pave over differences in: `clojure.edn/read-string`, `clojure.tools.edn/read-string`, `cljs.reader/read-string`, `cljs.tools.reader/read-string`. `cljs.reader` in particular can be a pain.
(read-sys-val id)
(read-sys-val prop-id env-id)
(reduce-indexed rf init coll)
Like reduce
but takes (rf [acc idx in]) with idx as in map-indexed
.
As reduce-kv
against vector coll, but works on any seqable coll type.
Like `reduce` but takes (rf [acc idx in]) with idx as in `map-indexed`. As `reduce-kv` against vector coll, but works on any seqable coll type.
(reduce-kvs rf init kvs)
Like reduce-kv
but takes a flat sequence of kv pairs.
Like `reduce-kv` but takes a flat sequence of kv pairs.
(reduce-n rf init end)
(reduce-n rf init start end)
(reduce-n rf init start end step)
(reduce-obj f init o)
Like reduce-kv
but for JavaScript objects.
Like `reduce-kv` but for JavaScript objects.
(reduce-top n rf init coll)
(reduce-top n keyfn rf init coll)
(reduce-top n keyfn cmp rf init coll)
Reduces the top n
items from coll
of N items.
Clj impln is O(N.logn) vs O(N.logN) for (take n (sort-by ...)).
Reduces the top `n` items from `coll` of N items. Clj impln is O(N.logn) vs O(N.logN) for (take n (sort-by ...)).
(remove-keys pred m)
(remove-kvs pred m)
(remove-vals pred m)
(removev pred coll)
(rename-keys replacements m)
Returns a map like the one given, replacing keys using the given {<old-new> <new-key>} replacements. O(min(n_replacements, n_m)).
Returns a map like the one given, replacing keys using the given {<old-new> <new-key>} replacements. O(min(n_replacements, n_m)).
(repeatedly* n & body)
(repeatedly-into coll n f)
Like repeatedly
but faster and conj
s items into given collection.
Like `repeatedly` but faster and `conj`s items into given collection.
(replace-in m & ops)
(reportf fmt & xs)
(reset!? atom_ val)
Atomically swaps value of atom_
to val
and returns
true iff the atom's value changed. See also reset-in!?
.
Atomically swaps value of `atom_` to `val` and returns true iff the atom's value changed. See also `reset-in!?`.
(reset-in! atom_ val)
(reset-in! atom_ ks val)
(reset-in! atom_ ks not-found val)
Like reset!
but supports update-in
semantics, returns <old-key-val>.
Like `reset!` but supports `update-in` semantics, returns <old-key-val>.
(reset-in!? atom_ val)
(reset-in!? atom_ ks val)
(reset-in!? atom_ ks not-found val)
Like reset-in!
but returns true iff the atom's value changed.
Like `reset-in!` but returns true iff the atom's value changed.
(reset-val! atom_ k val)
(reset-val! atom_ k not-found val)
Like reset-in!
but optimized for single-key case.
Like `reset-in!` but optimized for single-key case.
(reset-val!? atom_ k new-val)
Like reset-in!?
but optimized for single-key case.
Like `reset-in!?` but optimized for single-key case.
(revery pred coll)
(revery-kv pred coll)
(revery-kv? pred coll)
(revery? pred coll)
(revery? xform pred coll)
(rfirst pred coll)
(rfirst xform pred coll)
(rfirst-kv pred coll)
(ring-default-headers headers rresp)
(ring-merge-headers headers rresp)
(ring-redirect-resp url)
(ring-redirect-resp kind url)
(ring-redirect-resp kind url flash)
(ring-resp-map x)
(ring-set-body body rresp)
(ring-set-headers headers rresp)
(ring-set-status code rresp)
(rnum? x)
Returns true iff given number in signed unit proportion interval ∈ℝ[-1,1].
Returns true iff given number in signed unit proportion interval ∈ℝ[-1,1].
(rolling-counter msecs)
Experimental. Returns a RollingCounter that you can:
msecs
window and return RollingCounter.msecs
window.Experimental. Returns a RollingCounter that you can: - Invoke to increment count in last `msecs` window and return RollingCounter. - Deref to return count in last `msecs` window.
(round n & [type nplaces])
(round* n)
(round* type n)
(round* type nplaces n)
(round0 n)
(round1 n)
(round2 n)
(rsome pred coll)
(rsome xform pred coll)
(rsome-kv pred coll)
(run! proc coll)
(run-kv! proc m)
(run-kvs! proc kvs)
(run-obj! proc obj)
(sayf fmt & xs)
(sayp & xs)
(sb-append str-builder s)
(sb-append str-builder s & more)
For cross-platform string building
For cross-platform string building
(secs->ms secs)
(secure-rand-bytes size)
Returns size
random bytes using secure-rng
or js/window.crypto
.
Returns `size` random bytes using `secure-rng` or `js/window.crypto`.
(secure-rand-id alphabet len)
Experimental.
Given alphabet
(a string of possible characters), returns a securely
random string of length len
.
Trying to do this the obvious/naive way (by repeatedly generating a secure random number and mapping it to an alphabet character with modulo) actually introduces bias into ids that can be exploited by an attacker.
The method used here is designed to eliminate that bias. Based on https://bit.ly/3dtYv73.
Experimental. Given `alphabet` (a string of possible characters), returns a securely random string of length `len`. Trying to do this the obvious/naive way (by repeatedly generating a secure random number and mapping it to an alphabet character with modulo) actually introduces bias into ids that can be exploited by an attacker. The method used here is designed to eliminate that bias. Based on https://bit.ly/3dtYv73.
(secure-rng)
Returns a thread-local java.security.SecureRandom
.
Favours security over performance. Automatically re-seeds occasionally.
May block while waiting on system entropy!
Returns a thread-local `java.security.SecureRandom`. Favours security over performance. Automatically re-seeds occasionally. May block while waiting on system entropy!
(sentinel->nil x)
(sentinel? x)
(session-swap rreq rresp f & args)
Small util to help correctly manage (modify) funtional sessions. Please use this when writing Ring middleware! It's so easy to get this wrong and end up with subtle, tough-to-diagnose issues.
Small util to help correctly manage (modify) funtional sessions. Please use this when writing Ring middleware! It's *so* easy to get this wrong and end up with subtle, tough-to-diagnose issues.
(set-body rresp body)
(set-exp-backoff-timeout! nullary-f & [nattempt])
(set-status rresp code)
(simple-date-format pattern & [{:keys [locale timezone] :as opts}])
Returns a thread-local java.text.SimpleDateFormat
.
Returns a thread-local `java.text.SimpleDateFormat`.
(simple-date-format* pattern locale timezone)
(simple-ident? x)
(simple-keyword? x)
(simple-symbol? x)
(singleton? coll)
Like slurp-resource
but caches slurps against file's last-modified udt.
Like `slurp-resource` but caches slurps against file's last-modified udt.
(slurp-resource rname)
Returns slurped named resource on classpath, or nil when resource not found.
Returns slurped named resource on classpath, or nil when resource not found.
(some= x y)
(some= x y & more)
(some? x)
(sortv coll)
(sortv comparator coll)
(sortv ?keyfn comparator coll)
Like core/sort
but:
comparator
can be :asc
, :desc
, or an arbitrary comparator.keyfn
may be provided, as in core/sort-by
.Like `core/sort` but: - Returns a vector. - `comparator` can be `:asc`, `:desc`, or an arbitrary comparator. - An optional `keyfn` may be provided, as in `core/sort-by`.
(spaced-str xs)
(spaced-str-with-nils xs)
(str-?index s substr)
(str-?index s substr start-idx)
(str-?index s substr start-idx last?)
(str-builder? x)
(str-contains? s substr)
(str-ends-with? s substr)
(str-join coll)
(str-join separator coll)
(str-join separator xform coll)
Faster, transducer-based generalization of clojure.string/join
with xform
support
Faster, transducer-based generalization of `clojure.string/join` with `xform` support
(str-join-once separator coll)
Like string/join
but skips duplicate separators.
Like `string/join` but skips duplicate separators.
(str-replace s match replacement)
Like str/replace
but provides consistent clj/s behaviour.
Workaround for http://dev.clojure.org/jira/browse/CLJS-794, http://dev.clojure.org/jira/browse/CLJS-911.
Note that ClojureScript 1.7.145 introduced a partial fix for CLJS-911. A full fix could unfortunately not be introduced w/o breaking compatibility with the previously incorrect behaviour. CLJS-794 also remains unresolved.
Like `str/replace` but provides consistent clj/s behaviour. Workaround for http://dev.clojure.org/jira/browse/CLJS-794, http://dev.clojure.org/jira/browse/CLJS-911. Note that ClojureScript 1.7.145 introduced a partial fix for CLJS-911. A full fix could unfortunately not be introduced w/o breaking compatibility with the previously incorrect behaviour. CLJS-794 also remains unresolved.
(str-starts-with? s substr)
(stringy? x)
(sub-indexes x start-idx & {:keys [max-len end-idx]})
(submap? m sub)
Returns true iff sub
is a (possibly nested) submap of m
,
i.e. iff every (nested) value in sub
has the same (nested) value in m
.
Warning: uses stack recursion, so supports only limited nesting.
Returns true iff `sub` is a (possibly nested) submap of `m`, i.e. iff every (nested) value in `sub` has the same (nested) value in `m`. Warning: uses stack recursion, so supports only limited nesting.
(substr s start-idx & [?max-len])
Deprecated, prefer get-substr
or get-substring
Deprecated, prefer `get-substr` or `get-substring`
(subvec* v start-idx & [?max-len])
Deprecated, prefer get-subvec
or get-subvector
Deprecated, prefer `get-subvec` or `get-subvector`
(swap-in! atom_ f)
(swap-in! atom_ ks f)
(swap-in! atom_ ks not-found f)
Like swap!
but supports update-in
semantics,
returns <new-key-val> or <swapped-return-val>.
Like `swap!` but supports `update-in` semantics, returns <new-key-val> or <swapped-return-val>.
(swap-in!* atom_ f)
(swap-in!* atom_ ks f)
(swap-in!* atom_ ks not-found f)
Deprecated, prefer swap-in!
with swapped
return value.
Deprecated, prefer `swap-in!` with `swapped` return value.
(swap-val! atom_ k f)
(swap-val! atom_ k not-found f)
Like swap-in!
but optimized for single-key case.
Like `swap-in!` but optimized for single-key case.
(swap-val!* atom_ k f)
(swap-val!* atom_ k not-found f)
Deprecated, prefer swap-val!
with swapped
return value.
Deprecated, prefer `swap-val!` with `swapped` return value.
(swapped new-val return-val)
(swapped-vec x)
(swapped? x)
(takev n coll)
(thread-local-proxy & body)
(throwable? x)
(thrown form)
(thrown c form)
(thrown c pattern form)
Evaluates form
and returns ?throwable thrown by form that matches
given criteria:
c
may be:
:default
=> default platform throwable (Exception or js/Error):any
=> any platform throwable (Throwable or js/Error)pattern
may be
ex-message
will be matched.ex-data
will be matched.Useful for unit tests, e.g.: (is (thrown :default {:a :b} (throw (ex-info "Test" {:a :b :c :d}))))
Evaluates `form` and returns ?throwable thrown by form that matches given criteria: - `c` may be: - A class (e.g. ArithmeticException, AssertionError, etc.) - `:default` => default platform throwable (Exception or js/Error) - `:any` => any platform throwable (Throwable or js/Error) - `pattern` may be - A string or Regex against which `ex-message` will be matched. - A map against which `ex-data` will be matched. Useful for unit tests, e.g.: (is (thrown :default {:a :b} (throw (ex-info "Test" {:a :b :c :d}))))
(time-ms & body)
Returns number of milliseconds it took to execute body.
Returns number of milliseconds it took to execute body.
(time-ns & body)
Returns number of nanoseconds it took to execute body.
Returns number of nanoseconds it took to execute body.
(timeout-future? x)
(top n coll)
(top n keyfn coll)
(top n keyfn cmp coll)
Returns a sorted vector of the top n
items from coll
using reduce-top
.
Returns a sorted vector of the top `n` items from `coll` using `reduce-top`.
(top-into to n coll)
(top-into to n keyfn coll)
(top-into to n keyfn cmp coll)
Conjoins the top n
items from coll
into to
using reduce-top
.
Conjoins the top `n` items from `coll` into `to` using `reduce-top`.
(tracef fmt & xs)
(transient? x)
(udt? x)
(undefined->nil x)
(update-in m ks f)
(update-in m ks not-found f)
Like core/update-in
but:.
not-found
.:swap/dissoc
, :swap/abort
.Like `core/update-in` but:. - Empty ks will return (f m), not act like [nil] ks. - Adds support for `not-found`. - Adds support for special return vals: `:swap/dissoc`, `:swap/abort`.
(uri? x)
(url-decode s & [encoding])
Stolen from http://goo.gl/99NSR1
Stolen from http://goo.gl/99NSR1
(url-encode s & [encoding])
(url-encode s)
Based on https://goo.gl/fBqy6e
Based on https://goo.gl/fBqy6e
(use-fixtures* & args)
(uuid-str)
(uuid-str max-length)
Returns a UUIDv4 string of form "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx". Ref. http://www.ietf.org/rfc/rfc4122.txt, https://gist.github.com/franks42/4159427
Returns a UUIDv4 string of form "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx". Ref. http://www.ietf.org/rfc/rfc4122.txt, https://gist.github.com/franks42/4159427
(vec2? x)
(vec3? x)
(vinterleave-all c1 c2)
(vnext v)
(vrest v)
(vsplit-first v)
(vsplit-last v)
(warnf fmt & xs)
(when test-or-bindings & body)
Like core/when
but acts like when-let
when given a binding vector
as test expr.
Like `core/when` but acts like `when-let` when given a binding vector as test expr.
(when-let bindings & body)
Like core/when-let
but can bind multiple values for body
iff all tests
are truthy, supports internal unconditional :let
s.
Like `core/when-let` but can bind multiple values for `body` iff all tests are truthy, supports internal unconditional `:let`s.
(when-lets & args)
(when-not test-or-bindings & body)
Like core/when-not
but acts like when-let
when given a binding vector
as test expr.
Like `core/when-not` but acts like `when-let` when given a binding vector as test expr.
(when-some test-or-bindings & body)
(when? pred x)
(with-dynamic-assertion-data data & body)
Executes body with dynamic assertion data bound to given value. This data will be included in any violation errors thrown by body.
Executes body with dynamic assertion data bound to given value. This data will be included in any violation errors thrown by body.
(without-meta x)
(xdistinct)
(xdistinct keyfn)
(zero-num? x)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close