luvcraft/frontier.lisp
------------------------------------------------------------------------ Program definitions
Whether form is the frontier language word name, in any package.
Programs and bindings are written in their client packages, so the language recognizes its few reserved words by name rather than by symbol identity.
One field a program reads or writes by role name. RELAXED-P marks the best-known-value field of a monotone program; MEMO-P marks the visited identity of a discover-once program; INVALIDATED-P marks the field an invalidation program clears, whose source value is the level a cleared site had. Storage is bound at realization.
A raw truth value about the relation being exposed: (DIRECTION= constant) or CROSSING. Predicates enter arithmetic laws as unchecked flags.
One live semantic account of frontier-shaped materialization work. #X7Q90E
The definition names the dynamic family, physical frontier layout, and
neighborhood at an aggregate boundary, and states its local law: field roles,
realization constants, relation predicates, and the arithmetic TRANSFER,
ADMISSION, and PRIORITY forms over them. Concrete methods on
EXECUTE-FRONTIER-PROGRAM lower that account by hand; compile-frontier-program
lowers it mechanically over bound fields.
Return the live frontier program definition named by name.
Define an inspectable frontier program at one EQL-specialized name.
Notify retained realizations that program name changed.
Families are the semantic dynamics of #DURBKN. Each family knows which roles a program must declare and what its default admission, commit, and priority laws are. A definition is checked against its family at definition time so a wrong program fails before any realization.
Signal an error unless definition is well formed for family.
------------------------------------------------------------------------ Packed frontier storage and execution evidence
A finite highest-priority-first frontier of packed materialization sites.
Each bucket is a generated columnar buffer of aggregate identity plus dense offset. PRIORITY-MEANING retains the field or client declaration which gives the otherwise raw bucket number its meaning.
Admit one MATERIALIZATION/OFFSET site at finite priority.
A runtime-constructed `(INTEGER 0 ,maximum-priority) type specifier conses once per admission. Spell the same open-protocol check as primitive predicates so the packed frontier remains allocation-free.
Return MATERIALIZATION, OFFSET, PRIORITY, and PRESENT-P for the next site.
Inspectable semantic work evidence from one frontier execution.
ADMITTED-SITES is a packed frontier-site-buffer of every admitted site when
the program retains admissions, so a discover-once execution can hand its
component to the client without a cons per member, and an invalidation
execution its cleared set. EMISSIONS counts sites handed to a companion
frontier, such as the surviving sources an invalidation discovers.
Record one admitted relation and push its destination site.
Drain FRONTIER and execute body once for every spatial relation it exposes.
source is a retained aggregate materialization and SOURCE-OFFSET is its dense
site identity. TARGET is the local source or a materialization selected by
WINDOW at a crossing. DESTINATION has dynamic extent. The client body owns
admission, transfer, mutation, and unavailable-neighbor semantics; the macro
keeps traversal and value lifetimes visible to the compiler. This is the
manually staged lowering which compile-frontier-program now generates. #X7Q90E
------------------------------------------------------------------------ Field bindings: how one program role reaches physical storage
One program field role bound to storage reachable from a materialization.
declaration is the represented-value declaration (often a voxel field
definition) giving the field its quantity and Lisp representation. LANES are
(NAME FORM &key type): storage borrowed once per materialization, where FORM
mentions the template variable MATERIALIZATION. READ and WRITE are forms
over lane names, MATERIALIZATION, OFFSET, WINDOW, and (for WRITE) VALUE. A
LAZY binding is read where the law mentions it rather than once up front, so
a short-circuiting admission can skip an expensive probe. Templates are
ordinary inspectable data; the compiler substitutes them into the emitted
loop.
Return the finite integer maximum a declaration's legal values allow.
------------------------------------------------------------------------ Realizations
One program compiled over bound fields into closed scalar Lisp.
TRANSFER, ADMISSION, and PRIORITY are the checked arithmetic expression graphs; DRAIN-FORM and ADMIT-FORM are the emitted lambda forms; the two functions are their compiled realizations. ADMIT-FUNCTION seeds one site through the same admission and commit law as a relation, or is NIL when the law needs a source. RELATE-FUNCTION exposes one relation from a virtual source whose field values are supplied as arguments, so a boundary such as open sky is the program's own transfer law rather than client arithmetic. #53Q1II #581ZQP
Whether realization still reflects its program's live definition.
Make the packed frontier the realization's layout requires.
Run the compiled program until frontier is empty; return execution.
arguments are the program's constants as keywords. A program whose family
hands sites to a companion frontier, such as invalidation's surviving
sources, takes that frontier as the first argument before the keywords.
Seed one site through the program's admission and commit law.
For a monotone program value joins the relaxed field; for a discover-once
program value is ignored. Return whether the site was admitted.
Push MATERIALIZATION/OFFSET at priority for reconsideration, without law.
This is the frontier word for a site whose value already stands but whose relations must be exposed again, such as a resident chunk's face when a neighbour arrives. It is not an admission and is not retained.
Expose one relation into MATERIALIZATION/OFFSET from a virtual source.
arguments supply the program's constants and, keyed by role name, the source
field values the transfer reads; direction is the relation's direction as
seen from that source. The target is tested, committed, and admitted by the
same law as an ordinary relation. Return whether it was admitted. #581ZQP
------------------------------------------------------------------------ The compiler
Template variables. Binding authors write these symbols; the compiler substitutes the emitted loop's own variables for them.
Compiler bookkeeping for one bound field role.
Replace (FIELD ROLE) reads with the compiler's role symbols.
Every arithmetic reference target reachable from expression.
Substitute substitutions (name . form) into template, matching by name.
Working state for one compile-frontier-program call.
Parse one arithmetic law of the program in the compilation environment.
Require expression's quantity to be interpretable as lowered's field.
Return (VALUES TEST-FORM COMMIT-FORMS PRIORITY-FORM OTHERWISE-FORMS) for
one exposed target under family, given the lowering environment of bound
field values. candidate-variable names the transfer result for monotone
families, or the supplied value when seed-p says the target is being seeded
rather than reached through a relation. OTHERWISE-FORMS run when the test
fails, for families with a secondary effect. #FE0O5R
Clear a dependent target and re-admit it at the level it had; hand an independent lit target to the companion frontier as a surviving source.
The invalidated field's source value is the popped priority: the level the cleared source had. A seed clears the site unconditionally and admits it at the supplied value.
Whether family's drain hands sites to a second, companion frontier.
The finite bucket range: from the relaxed or invalidated field's legal values.
Close program over field bindings and emit its scalar realization.
site-domain is a form over MATERIALIZATION yielding the chunk domain that
gives a site's dense offset spatial meaning. Each field role of the program
must have one frontier-field-binding. The laws are parsed and quantity
checked against the bound fields, lowered with scalar arithmetic, and spliced
into one closed loop over raw buckets and lanes. With compile NIL the forms
are emitted but not compiled, for inspection. #53Q1II #T2G95K #716UN6
Parse and check the laws.
Emission. The generated loop is deliberately plain: raw bucket vectors
and counters are bound once at entry and written back at exit; the source
site's lanes and field values are bound once per pop; the popped site is
validated once and its six relations are primitive fixnum steps
(do-chunk-site-neighbors, #FGT96H); a target's lanes are the source's own
for a local step and are borrowed from the crossing materialization
otherwise. Nothing per relation is generic, checked twice, or allocated.
Map every arithmetic parameter to the emitted form holding its value.
Eager fields are read once into a variable; lazy fields lower to their read form wherever the law mentions them.
LET* bindings and declarations reading the role values the laws need.
Emit the test, commits, and admission for one exposed target site.
A local step's target lanes are the source's own, so every lane a target reads is also borrowed at the source.
Emit the seed entry point, or NIL when the law needs a source or relation.
Emit the virtual-source relation entry point.
The source role's field values arrive as keyword arguments named by role, the relation direction as an argument, and the crossing predicate is true: a virtual source is by definition outside the target's materialization.
One live semantic account of frontier-shaped materialization work. #X7Q90E The definition names the dynamic family, physical frontier layout, and neighborhood at an aggregate boundary, and states its local law: field roles, realization constants, relation predicates, and the arithmetic TRANSFER, ADMISSION, and…
One program compiled over bound fields into closed scalar Lisp. TRANSFER, ADMISSION, and PRIORITY are the checked arithmetic expression graphs; DRAIN-FORM and ADMIT-FORM are the emitted lambda forms; the two functions are their compiled realizations. ADMIT-FUNCTION seeds one site through the same admission and…
(form name)Whether FORM is the frontier language word NAME, in any package. Programs and bindings are written in their client packages, so the language recognizes its few reserved words by name rather than by symbol identity.
Logical conjunction of tests and raw truth values.
Logical negation of one test or raw truth value.
One field a program reads or writes by role name. RELAXED-P marks the best-known-value field of a monotone program; MEMO-P marks the visited identity of a discover-once program; INVALIDATED-P marks the field an invalidation program clears, whose source value is the level a cleared site had. Storage is bound at…
A raw truth value about the relation being exposed: (DIRECTION= constant) or CROSSING. Predicates enter arithmetic laws as unchecked flags.
(program &key bindings site-domain (compile t))Close PROGRAM over field BINDINGS and emit its scalar realization. SITE-DOMAIN is a form over MATERIALIZATION yielding the chunk domain that gives a site's dense offset spatial meaning. Each field role of the program must have one FRONTIER-FIELD-BINDING. The laws are parsed and quantity checked against the bound…
(name)Return the live frontier program definition named by NAME.
One top-level defining form of a source file.
Test whether two compatible scalars are equal.
(name &key family frontier-layout neighborhood fields constants predicates
transfer admission priority
retain-admissions source-form)(family definition)Signal an error unless DEFINITION is well formed for FAMILY.
(name &rest options
&key family frontier-layout neighborhood fields constants predicates
transfer admission priority retain-admissions)(name)Notify retained realizations that program NAME changed.
(definition)(definition)(definition)(name-and-options &body lane-descriptions)Define a concrete synchronized structure-of-arrays buffer. Each lane is (NAME INITIAL-ELEMENT :TYPE TYPE [:CLEAR-ON-REMOVE T]). Optional :QUANTITIES on NAME-AND-OPTIONS groups named physical lanes into fixed quantity projections. The generated MAKE-, -PUSH, -POP, and -RESET functions operate on raw specialized…
A finite highest-priority-first frontier of packed materialization sites. Each bucket is a generated columnar buffer of aggregate identity plus dense offset. PRIORITY-MEANING retains the field or client declaration which gives the otherwise raw bucket number its meaning.
(&key maximum-priority priority-meaning (initial-capacity 256))(frontier)(frontier materialization offset priority)Test whether one compatible scalar is at most another.
The maximum of compatible quantities.
(frontier)Inspectable semantic work evidence from one frontier execution. ADMITTED-SITES is a packed FRONTIER-SITE-BUFFER of every admitted site when the program retains admissions, so a discover-once execution can hand its component to the client without a cons per member, and an invalidation execution its cleared set. …
(program input frontier &key retain-admissions)Logical disjunction of tests and raw truth values.
(execution materialization offset priority)((source source-offset priority
target target-offset direction destination crossing availability
frontier window domain directions
&key execution result)
&body body)Drain FRONTIER and execute BODY once for every spatial relation it exposes. SOURCE is a retained aggregate materialization and SOURCE-OFFSET is its dense site identity. TARGET is the local SOURCE or a materialization selected by WINDOW at a crossing. DESTINATION has dynamic extent. The client body owns admission,…
(domain offset)((offset destination crossing direction materialization availability
window domain local directions &optional result)
&body body)Execute BODY for the DIRECTIONS neighboring LOCAL through WINDOW. DIRECTIONS is the caller's explicit neighborhood policy. DESTINATION has dynamic extent on each iteration and must be copied before BODY retains it. Interior steps remain domain arithmetic; window dispatch occurs only at an actual chunk crossing.…
One program field role bound to storage reachable from a materialization. DECLARATION is the represented-value declaration (often a voxel field definition) giving the field its quantity and Lisp representation. LANES are (NAME FORM &key TYPE): storage borrowed once per materialization, where FORM mentions the…
PROPERTY: VALUES; -- the property a keyword, the values a list written space-separated.
Headings, paragraphs, figures and their IDs, mentions, marks.
(name &key declaration lanes read write lazy)(declaration)Return DECLARATION's homogeneous quantity specification, or NIL.
(declaration)Return DECLARATION's backend or Common Lisp representation type, or NIL.
(declaration)Return the finite integer maximum a declaration's legal values allow.
One distributed fact's identity and per-site meaning. #FKAV5Y The inherited represented-value declaration describes a reading after its storage encoding has been resolved. REPRESENTATION-POLICY separately names the aggregate encoding, such as a palette-index column or a u8 level array.
((call tool-call) stream)(realization)(realization &key (initial-capacity 256))(realization input frontier)(realization window frontier execution &rest arguments)Run the compiled program until FRONTIER is empty; return EXECUTION. ARGUMENTS are the program's constants as keywords. A program whose family hands sites to a companion frontier, such as invalidation's surviving sources, takes that frontier as the first argument before the keywords.
(realization window frontier execution materialization offset value
&rest constants)Seed one site through the program's admission and commit law. For a monotone program VALUE joins the relaxed field; for a discover-once program VALUE is ignored. Return whether the site was admitted.
(realization frontier execution materialization offset priority)Push MATERIALIZATION/OFFSET at PRIORITY for reconsideration, without law. This is the frontier word for a site whose value already stands but whose relations must be exposed again, such as a resident chunk's face when a neighbour arrives. It is not an admission and is not retained.
(realization window frontier execution materialization offset direction
&rest arguments)Expose one relation into MATERIALIZATION/OFFSET from a virtual source. ARGUMENTS supply the program's constants and, keyed by role name, the source field values the transfer reads; DIRECTION is the relation's direction as seen from that source. The target is tested, committed, and admitted by the same law as an…
Alist of field role name to quantity specification while parsing laws.
Compiler bookkeeping for one bound field role.
(name role)(name specification)(name &optional documentation)Assert that a raw or foreign value is measured in a program field's quantity.
(operator form environment)Parse one arithmetic call into an inspectable expression.
(form environment)(expression)Whether semantic quantity checking is active at EXPRESSION.
(form fields)(expression)(template substitutions)(binding lanes-alist materialization-variable)(binding lanes-alist)(lowered role offset-variable)(lowered offset-variable value-form)Working state for one COMPILE-FRONTIER-PROGRAM call.
(compilation name)(compilation)(compilation)(compilation)(compilation form)(expression lowered what)(derived interpretation)Give a compatible anonymous DERIVED specification an explicit meaning. This is a semantic interpretation, never a numerical unit conversion. An already named quantity may only retain its name; anonymous derived results may acquire one when their dimension, exact unit, and tensor order agree with INTERPRETATION. …
(compilation expression lowering-environment)How LOWER-LISP-ARITHMETIC-EXPRESSION emits calls: :GENERIC uses the representation-dispatching LISP-ADD family; :SCALAR emits CL operators over declared scalar operands. #53Q1II
(expression environment)Lower checked EXPRESSION to ordinary Lisp using target-to-name ENVIRONMENT.
(family compilation candidate-variable
lowering-environment &key seed-p)Return (VALUES TEST-FORM COMMIT-FORMS PRIORITY-FORM OTHERWISE-FORMS) for one exposed target under FAMILY, given the lowering environment of bound field values. CANDIDATE-VARIABLE names the transfer result for monotone families, or the supplied value when SEED-P says the target is being seeded rather than reached…
Test whether one compatible scalar is greater than another.
(family)Whether FAMILY's drain hands sites to a second, companion frontier.
(definition)(definition relaxed-binding)How the children of a list are arranged.
(predicate)(compilation)(compilation)(compilation)Emit the virtual-source relation entry point. The source role's field values arrive as keyword arguments named by role, the relation direction as an argument, and the crossing predicate is true: a virtual source is by definition outside the target's materialization.
((offset crossing direction materialization availability
window domain site-offset directions &optional result)
&body body)Execute BODY for the DIRECTIONS neighboring the site at SITE-OFFSET. This is the trusted-scope counterpart of DO-CHUNK-WINDOW-NEIGHBORS for a site already proved to belong to DOMAIN, such as one popped from a packed frontier. DOMAIN and SITE-OFFSET are validated once; the shape's dimensions and the site's components…
(compilation &key (source-p t))Map every arithmetic parameter to the emitted form holding its value. Eager fields are read once into a variable; lazy fields lower to their read form wherever the law mentions them.
(compilation)(compilation role offset-variable referenced)(&body body)The declarations BODY makes, read as a rule body, for a rule to include: the way to write a mixin.
(compilation candidate-form lowering-environment
&key admit-form seed-p)(compilation)(compilation)(compilation)(compilation)(compilation)The workloads fall into at least three algorithmic families. – Discover once. Connected components and terminal-wall assembly usually assign each reachable site once for one source revision. A visited bit or component memo prevents repeated work. – Relax monotonically. Distances, influence, and light addition keep…
This page takes an affirmative position: frontier-shaped computation is a real organizing principle for luvcraft, and Common Lisp gives us unusually good means to make that principle executable. The intention is not merely to extract a queue utility from lighting. It is to grow a small frontier language in which a…
Intent: let the realization admit a virtual open-sky source through the program's own transfer law, so seeding stops restating the loss arithmetic in client code and a boundary is just a relation whose source is not a site. Evidence: every realization now also emits a relate entry (relate-frontier-realization-site):…
The :family clause is semantic, not a label. #DURBKN's dynamics become compiler knowledge: A definition is checked against its family when it is defined, so a monotone program without a relaxed field fails before any realization. This is why the light program states only its transfer, and the terminal program only…
The proposed frontier language is a DSL compiler, not a generic worklist framework whose inner loop depends on accidental devirtualization. A live, inspectable program definition remains open to Common Lisp development; one compilation closes that definition over particular fields, domains, neighborhoods,…
A frontier program is now written as its own semantic source rather than as a name attached to a handwritten loop. Voxel light reads: The clauses divide along the two languages of #53Q1II. :fields names roles the program reads or writes at source and target without saying where they live. :constants are values…
compile-frontier-program takes the definition, one frontier-field-binding per role, and a site-domain template. A binding names the represented-value declaration that gives the field its quantity and Lisp type (for light, the :sky-light voxel field definition and the light-opacity slot declaration), the lanes it…
Intent: preserve checked public domain stepping while avoiding the same bounds and coordinate type validation for each of a trusted worklist site's six neighbors. The packed frontier already proves its entry and offset; adjacency should validate that site once, then keep primitive steps inside the checked scope.…
Inspectable frontier programs over packed, domain-addressed work, and the compiler which closes one program over bound fields into a scalar loop.
Two languages meet here. The frontier language owns work-generating effects: pop a site, expose its relations, read and commit fields, admit another site, count evidence. The arithmetic language owns pure value laws: transfer, admission tests, and priorities, quantity-checked against the fields they read. A
frontier-program-definitionis the open, redefinable source; afrontier-realizationis one compilation of it over particular field bindings, retaining the checked expressions, the emitted form, and the compiled function. #53Q1II