Skip to main content

Module verb

Module verb 

Source
Expand description

Verbs and the rank machinery: the language-agnostic execution core.

A Verb is a semantic object — a primitive or a combination of verbs — applied monadically or dyadically to arrays. Frontends lower J/APL syntax to Verb trees; nothing in here knows any surface syntax.

Structs§

Ctx
Execution context threaded through evaluation.
Env
The names a running program can reach: the values it has assigned, the verbs it has named, and the arguments bound to its parameters.
EvalCfg
The effect-free half of the execution context. Copyable, so a path that runs cells on other threads can carry it there; the output sink cannot go along, which is what keeps those paths pure by construction.
Prim
A primitive verb: a name for diagnostics, both valence meanings, and J-style ranks [monadic, dyadic-left, dyadic-right].
Tol
How close two floats have to be to count as equal.

Enums§

Agreement
How dyadic frames must agree. A property of the source language, fixed per compiled program.
BoolDyad
The dyadic operations that read and write booleans and nothing else.
DyadOp
Dyadic meaning of a primitive.
Enclose
How a value is put into a box.
MonadOp
Monadic meaning of a primitive.
Power
How many times a Verb::PowerN applies its verb.
ScalarDyad
Elementwise dyadic operations (cell ranks 0 0).
ScalarMonad
Elementwise monadic operations (cell rank 0).
Verb
A verb: primitive or derived. Language-agnostic; frontends decide which combinations their syntax produces (e.g. APL +/ becomes Rank(Reduce(+), [1,1,1]) — reduce the last axis).
WindowKind
Which windowed application a Verb::Windowed performs. One variant covers all three because the work is the same: the verb is applied to a run of consecutive items, and only the choice of runs differs.

Constants§

RANK_INF
Infinite rank (applies to the argument as a whole).
RECURSION_LIMIT
How deep explicit definitions may call each other before libjay stops them. Recursion that runs away is a program bug; the diagnostic says so rather than letting the process die on a stack overflow.

Functions§

amend_at
APL A[i;j]←v: base with the elements the slots select replaced by value. An elided slot takes its whole axis; a scalar slot drops its axis from the shape the value has to match. The base is copied, so the array the name held before is untouched.
effective_rank
Effective cell rank: nonnegative rank clamps to the argument’s rank; negative rank means “leave |r| frame axes” (at least rank 0 cells).

Type Aliases§

MemoCache
The results u M. has already computed, keyed by the arguments that produced them. Shared by every clone of the derived verb, which is what makes the cache survive from one application to the next.