io.github.frenchy64.fully-satisfies.uniform

Variants of clojure.core functions that are generalized
to work uniformly for all values.

In all cases, a namespaced keyword was used as a special value
that, if provided to the function, would break its promised semantics.
The fixes involved replacing these special values with globally unique
ones that are inaccessible to normal users (or more practically, unlikely
to be generated with a generator like gen/any, or one that sources its
values from the keyword interning table).

These corner-cases are demonstrated in io.github.frenchy64.fully-satisfies.uniform-test.

An effective generator that could find such defects reliably could generate
keywords that occur in the source code of the functions reachable from the
generative property (using static analysis, but perhaps this is also retrievable
dynamically from the bytecode). On the other hand, such invasive analyses could
yield false-negatives by providing values normally inaccessible to the user.

dedupe

added in 1.7

(dedupe)(dedupe coll)
Returns a lazy sequence removing consecutive duplicates in coll.
Returns a transducer when no collection is provided.

lazier/dedupe additionally:
- does not force a lazy seq until needed
- forces 32 elements per chunk instead of 33, preserving 32 elements
per chunk.
- transducer arity behaves correctly for all inputs (including :clojure.core/none)

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.

uniform/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 uniform/partition-by transducer behaves uniformly for
all values (including :clojure.core/none).