Deterministic planner. Pure: a profile and a registry in, a Result out.
Search order is fixed: realizations by [cost id], direct ones before delegation through a context wrapper, 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 order is fixed: realizations by [cost id], direct ones before delegation through a context wrapper, 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).
(candidates env visited lang intent)Lazy, deterministic seq of candidates for intent in lang. visited holds the languages already on the context stack, so delegation never cycles.
Lazy, deterministic seq of candidates for intent in lang. visited holds the languages already on the context stack, so delegation never cycles.
(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.
(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).
(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.
(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.
(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.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |