Unorthodox control flow, for Clojurists with masochistic sensibilities. Available via clojars.
See dom-top.core for comprehensive documentation with examples.
assert+
works likeassert
, but returns truthy values being tested, and throws other types of exceptions (including maps, via ex-info!)bounded-future
is just likefuture
, but for CPU-bound tasks.bounded-pmap
, by contrast, puts a global limit on parallelism for CPU-bound tasks.disorderly
is ado
block that evaluates statements in a new, random order every time, instead of sequentially.fcatch
lifts functions that throw exceptions into functions that return exceptions.letr
provides let bindings with early return; particular useful for aborting early on failure cases.loopr
expresses reductions with multiple accumulators over multiple dimensions. It combines the nested iteration offor
, the multiple accumulators/dimensions ofloop
, and the concise iteration/accumulation structure ofreduce
. Also, it's fast.reducer
builds a reducing function for multiple accumulators, carrying state in a dynamically-compiled, primitive-aware, mutable accumulator datatype. For simple reductions it's about twice as fast as an idiomatic vector accumulator.real-pmap
provides a fully parallel version ofmap
, which spawns one thread per element, instead of running on a limited threadpool.with-retry
providesrecur
that works throughtry/catch
blocks; particularly useful for retrying network operations.
Look, this is a judgement-free zone, OK? We all have our reasons.
Justin Conklin offered advice on ASM and wrote the core of dom-top's generator of mutable accumulators.
Copyright © 2017--2023 Kyle Kingsbury
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.