Liking cljdoc? Tell your friends :D

grammar.candidate

Candidate programs: code plus the provenance that justifies it.

{:code program text :via realization and wrapper ids, pre-order :requires every capability the text relies on :stack languages from outermost to innermost :cost structural cost, a number >= 0: realization and wrapper costs summed, a literal encoder adding 0 :key the ranks on the way in pre-order, each [kind cost id], kind 0 for a realization and 1 for a wrapper; it orders equal costs}

Every key is mandatory: stamp, enclose and merge-parts add to :cost and :key, so a hand-built candidate without them throws. Ranks come from realization-rank and wrapper-rank and queue entries from bound and stream, so the [kind cost id] grammar of keys is written only here.

Candidate programs: code plus the provenance that justifies it.

{:code     program text
 :via      realization and wrapper ids, pre-order
 :requires every capability the text relies on
 :stack    languages from outermost to innermost
 :cost     structural cost, a number >= 0: realization and wrapper costs
           summed, a literal encoder adding 0
 :key      the ranks on the way in pre-order, each [kind cost id], kind
           0 for a realization and 1 for a wrapper; it orders equal costs}

Every key is mandatory: stamp, enclose and merge-parts add to :cost and
:key, so a hand-built candidate without them throws. Ranks come from
realization-rank and wrapper-rank and queue entries from bound and
stream, so the [kind cost id] grammar of keys is written only here.
raw docstring

*product*clj

How combine builds a product: (fn [f seqs] candidates). Default best-first-product. The seam a reference test binds to the full, unordered product, to check the search against an enumeration that does not share its ordering code.

How combine builds a product: (fn [f seqs] candidates). Default
best-first-product. The seam a reference test binds to the full,
unordered product, to check the search against an enumeration that does
not share its ordering code.
sourceraw docstring

best-firstclj

(best-first entries)

Lazy seq of candidates, cheapest :cost first, from queue entries:

a candidate emitted when popped {:open f ...} a bound: f returns an ascending seq of entries {:stream s ...} an ascending seq of entries, opened one at a time

An entry's :cost is a lower bound for everything it opens; :key ranks ties. A bound costs nothing until it reaches the front of the queue.

Lazy seq of candidates, cheapest :cost first, from queue entries:

a candidate        emitted when popped
{:open f ...}      a bound: f returns an ascending seq of entries
{:stream s ...}    an ascending seq of entries, opened one at a time

An entry's :cost is a lower bound for everything it opens; :key ranks
ties. A bound costs nothing until it reaches the front of the queue.
sourceraw docstring

best-first-productclj

(best-first-product f seqs)

Lazy product of the candidate seqs in seqs, cheapest total cost first. Each seq must be ascending by :cost. f receives the codes and returns the combined code. Ties pop by key, then by index tuple, so the walk is deterministic. An element of an input seq is realized only once an output needs it.

Lazy product of the candidate seqs in seqs, cheapest total cost first.
Each seq must be ascending by :cost. f receives the codes and returns the
combined code. Ties pop by key, then by index tuple, so the walk is
deterministic. An element of an input seq is realized only once an
output needs it.
sourceraw docstring

boundclj

(bound cost key open)

A queue entry costing cost, ranked by key, that opens (open) only when it reaches the front: open returns an ascending seq of entries, each costing at least cost and keyed under key.

A queue entry costing cost, ranked by key, that opens (open) only when it
reaches the front: open returns an ascending seq of entries, each costing
at least cost and keyed under key.
sourceraw docstring

combineclj

(combine f & seqs)

Lazy product of candidate seqs, cheapest total cost first (see best-first-product, the default product).

Lazy product of candidate seqs, cheapest total cost first (see
best-first-product, the default *product*).
sourceraw docstring

empty-queueclj

A queue holding no entries.

A queue holding no entries.
sourceraw docstring

encloseclj

(enclose w ic oc)

The candidate of wrapper w around inner candidate ic, oc being the candidate w rendered for ic's code in w's outer language: oc's code, provenance in pre-order (w, then ic, then oc), w's cost added to both, w's rank leading the key.

The candidate of wrapper w around inner candidate ic, oc being the
candidate w rendered for ic's code in w's outer language: oc's code,
provenance in pre-order (w, then ic, then oc), w's cost added to both,
w's rank leading the key.
sourceraw docstring

entry-kindclj

(entry-kind e)

The kind of queue entry e: :bound when it has an :open fn, :stream when it has a :stream, else :candidate.

The kind of queue entry e: :bound when it has an :open fn, :stream when it
has a :stream, else :candidate.
sourceraw docstring

expandcljmultimethod

What popping entry e yields: {:emit candidate} or {:enqueue entries}, entries to push in order. Only a popped bound calls its :open, and only a popped stream realizes its next element.

What popping entry e yields: {:emit candidate} or {:enqueue entries},
entries to push in order. Only a popped bound calls its :open, and only a
popped stream realizes its next element.
sourceraw docstring

leafclj

(leaf code)

A single candidate from an encoder result, or none when it returned nil. It costs nothing by itself; stamp adds the realization's cost.

A single candidate from an encoder result, or none when it returned nil.
It costs nothing by itself; stamp adds the realization's cost.
sourceraw docstring

merge-partsclj

(merge-parts f parts)

One candidate from candidates parts, in order: :code is f applied to their codes, :via and :key concatenate, :requires unions, :stack is the longest, :cost sums.

One candidate from candidates parts, in order: :code is f applied to
their codes, :via and :key concatenate, :requires unions, :stack is the
longest, :cost sums.
sourceraw docstring

pop-minclj

(pop-min queue)

[e rest] for the least entry e of queue and the queue without it, or nil when queue is empty. e carries no insertion number.

[e rest] for the least entry e of queue and the queue without it, or nil
when queue is empty. e carries no insertion number.
sourceraw docstring

pushclj

(push queue e)
(push queue e n)

queue with entry e added, numbered n, by default the queue's insertion count; nil leaves it unchanged. Entries of equal :cost and :key pop by number, so in push order when numbered by default.

That FIFO is the queue's, not best-first's: a popped bound re-enters as a stream with a fresh number. Pre-order among equal costs in best-first rests on keys being unique, not on push order.

queue with entry e added, numbered n, by default the queue's insertion
count; nil leaves it unchanged. Entries of equal :cost and :key pop by
number, so in push order when numbered by default.

That FIFO is the queue's, not best-first's: a popped bound re-enters as a
stream with a fresh number. Pre-order among equal costs in best-first
rests on keys being unique, not on push order.
sourceraw docstring

realization-rankclj

(realization-rank r)

The key rank of realization r: [0 cost id].

The key rank of realization r: [0 cost id].
sourceraw docstring

stampclj

(stamp cand r lang)

Attribute cand to realization r rendered in lang: r's weight is added and its rank leads the key.

Attribute cand to realization r rendered in lang: r's weight is added and
its rank leads the key.
sourceraw docstring

streamclj

(stream s)
(stream cost key s)

A queue entry over s, an ascending seq of entries, realized one element at a time. cost and key rank it until its head is realized.

A queue entry over s, an ascending seq of entries, realized one element
at a time. cost and key rank it until its head is realized.
sourceraw docstring

successorsclj

(successors t)

The index tuples after tuple t: t with one coordinate incremented, for each coordinate at or after its last nonzero one. From the zero tuple this reaches every tuple of naturals exactly once.

The index tuples after tuple t: t with one coordinate incremented, for
each coordinate at or after its last nonzero one. From the zero tuple this
reaches every tuple of naturals exactly once.
sourceraw docstring

weightclj

(weight r)

What realization r adds to a candidate's :cost: its :cost, except a literal encoder, which adds nothing; its cost ranks ties through :key.

What realization r adds to a candidate's :cost: its :cost, except a
literal encoder, which adds nothing; its cost ranks ties through :key.
sourceraw docstring

wrapper-rankclj

(wrapper-rank w)

The key rank of wrapper w: [1 cost id], after every realization of equal cost, so a direct realization wins a tie against a delegation.

The key rank of wrapper w: [1 cost id], after every realization of equal
cost, so a direct realization wins a tie against a delegation.
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