Liking cljdoc? Tell your friends :D

grammar.solve

Deterministic planner. Pure: a profile and a registry in, a Result out.

Search is best-first by structural cost: a candidate's cost is the sum of its realization and wrapper costs, literal encoders adding 0, so a direct realization can lose to a cheaper delegation. Equal costs break by pre-order (direct before delegation, realizations by [cost id], children left to right). The first candidate whose text satisfies the profile's text constraints wins.

A realization is admitted only when every capability it requires is :yes. An :unknown never selects a program. When nothing is admitted the search runs again with unknowns let through, only to report what resolving them would unlock (:blocked-on-unknown).

Deterministic planner. Pure: a profile and a registry in, a Result out.

Search is best-first by structural cost: a candidate's cost is the sum
of its realization and wrapper costs, literal encoders adding 0, so a
direct realization can lose to a cheaper delegation. Equal costs break
by pre-order (direct before delegation, realizations by [cost id],
children left to right). The first candidate whose text satisfies the
profile's text constraints wins.

A realization is admitted only when every capability it requires is
:yes. An :unknown never selects a program. When nothing is admitted the
search runs again with unknowns let through, only to report what
resolving them would unlock (:blocked-on-unknown).
raw docstring

candidatesclj

(candidates env visited lang intent)

Lazy, deterministic seq of candidates for intent in lang, cheapest total cost first; ties go to a direct realization, then by cost and id. visited holds the languages already on the context stack, so delegation never cycles.

Lazy, deterministic seq of candidates for intent in lang, cheapest total
cost first; ties go to a direct realization, then by cost and id. visited
holds the languages already on the context stack, so delegation never
cycles.
sourceraw docstring

explainclj

(explain env langs [op :as intent] pairs)

Every option the planner had for intent, with its required capabilities split by verdict. pairs restricts wrappers to those [outer inner] pairs; nil means every cross-language wrapper between langs.

Every option the planner had for intent, with its required capabilities
split by verdict. pairs restricts wrappers to those [outer inner] pairs;
nil means every cross-language wrapper between langs.
sourceraw docstring

make-envclj

(make-env profile {:keys [realizations wrappers admit] :or {admit p/admits?}})

Planning environment over profile. admit is (fn [profile requires] bool), default grammar.profile/admits? (all :yes).

Planning environment over profile. admit is (fn [profile requires] bool),
default grammar.profile/admits? (all :yes).
sourceraw docstring

requires-ofclj

(requires-of r intent)

Capabilities realization r relies on for intent: its static :requires plus whatever its optional :requires-of (fn [intent] caps) adds.

Capabilities realization r relies on for intent: its static :requires
plus whatever its optional :requires-of (fn [intent] caps) adds.
sourceraw docstring

solveclj

(solve env lang intent)
(solve env lang intent {:keys [stack budget] :or {budget 5000}})

Plan intent in lang under env. opts: :stack (force a context stack, outermost first; overrides lang), :budget (max candidates examined). Always returns a grammar.schema/Result.

Plan intent in lang under env. opts: :stack (force a context stack,
outermost first; overrides lang), :budget (max candidates examined).
Always returns a grammar.schema/Result.
sourceraw docstring

utf8-lenclj

(utf8-len s)
source

violationsclj

(violations {:keys [max-len forbid]} code)

Text constraints a program breaks. Empty vector when it satisfies them.

Text constraints a program breaks. Empty vector when it satisfies them.
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