io.github.frenchy64.fully-satisfies.uniform
Variants of clojure.core functions that are generalized
to work uniformly for all values.
halt-when
added in 1.9
(halt-when pred)
(halt-when pred retf)
Returns a transducer that ends transduction when pred returns true
for an input. When retf is supplied it must be a fn of 2 arguments -
it will be passed the (completed) result so far and the input that
triggered the predicate, and its return value (if it does not throw
an exception) will be the return value of the transducer. If retf
is not supplied, the input that triggered the predicate will be
returned. If the predicate never returns true the transduction is
unaffected.
cornerless/halt-when also works uniformly for all values (including
returning a map with key :clojure.core/halt).
partition-by
added in 1.2
(partition-by f)
(partition-by f coll)
Applies f to each value in coll, splitting it each time f returns a
new value. Returns a lazy seq of partitions. Returns a stateful
transducer when no collection is provided.
Additionally, the cornerless/partition-by transducer behaves uniformly for
all values (including :clojure.core/none).