Liking cljdoc? Tell your friends :D

grammar.law

Laws a language module must keep, as plain checks a module author can call from a property test.

The length law: no output of an encoder is shorter, in UTF-8 bytes, than the text it encodes, and no output of a realization or wrapper is shorter than any piece it embeds. grammar.solve relies on it to prune every candidate already over a profile's :max-len, together with everything that would be built from it. An entry that cannot keep it declares :shortens? true; pruning is then off beneath it, and the law does not apply to it.

Laws a language module must keep, as plain checks a module author can
call from a property test.

The length law: no output of an encoder is shorter, in UTF-8 bytes, than
the text it encodes, and no output of a realization or wrapper is shorter
than any piece it embeds. grammar.solve relies on it to prune every
candidate already over a profile's :max-len, together with everything
that would be built from it. An entry that cannot keep it declares
:shortens? true; pruning is then off beneath it, and the law does not
apply to it.
raw docstring

length-law-violationsclj

(length-law-violations {:keys [realizations wrappers]} intent-of s piece)

Every breach of the length law by the entries of registry ({:realizations [...] :wrappers [...]}, a composed module set) for one sample: text s for encoders, intent-of (fn [intent-kw s] intent) for other realizations, s as the inner code for wrappers, and piece as what every literal they ask for renders to. A wrapper's output is held to the longer of piece and its inner code s: pruning drops an inner candidate by its own length, before the wrapper encodes it. Entries declaring :shortens? are skipped. Empty when the law holds for this sample.

Every breach of the length law by the entries of registry
({:realizations [...] :wrappers [...]}, a composed module set) for one
sample: text s for encoders, intent-of (fn [intent-kw s] intent) for
other realizations, s as the inner code for wrappers, and piece as what
every literal they ask for renders to. A wrapper's output is held to the
longer of piece and its inner code s: pruning drops an inner candidate by
its own length, before the wrapper encodes it. Entries declaring :shortens? are
skipped. Empty when the law holds for this sample.
sourceraw docstring

utf8-lenclj

(utf8-len s)

Length of s in UTF-8 bytes.

Length of s in UTF-8 bytes.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close