couplet.core

Core utilities for working with Unicode code points.

append!

(append!)(append! sb)(append! sb cp)
Reducing function applicable to code point input, with accumulation based on
(mutable) StringBuilder. When called with no arguments, returns a new
StringBuilder. When called with a StringBuilder argument, returns its contents
as a string (for use in completion of transduce).

codepoint-in

macro

(codepoint-in start end)
Returns a spec that validates (and generates) code points in the range from
start to end inclusive.

The predefined spec :couplet.core/codepoint validates all code points.

codepoint-str

(codepoint-str cp)
Returns a string containing the Unicode character specified by code point cp.

codepoint?

(codepoint? x)
Returns true if x is a code point.

Corresponds to the spec :couplet.core/codepoint.

codepoints

(codepoints)(codepoints s)
Returns a value that acts like a sequence of code points produced from the given
CharSequence s. The result is of a type that is seqable, reducible, and
foldable. The wrapped CharSequence is treated as immutable (like a string).

Unlike CharSequence, the value returned from codepoints is not counted? and does
not support random access. Use seq to obtain a regular (lazy) seq of code
points.

When no argument is supplied, returns a stateful transducer that transforms char
inputs to code points.

surrogate?

(surrogate? cp)
Returns true if code point cp is a surrogate code point.

to-str

(to-str coll)(to-str xform coll)
Returns a string containing the code points in coll. When a transducer is
supplied, applies the transform to the inputs before appending them to the
result.

Same as (transduce xform append! coll), so coll must either directly or by way
of transformation through xform consist of code points.