lang
Nu the language, layer 1 on the engine.
Module nu.lang.
Nu the language, layer 1 on the engine.
lang is Nu defined on top of nu.engine. Top-level vocabulary:
nu- theNubase class.kinds- the kind taxonomy (Ref/Interaction/ScalarQuery/ ...).args- argument type aliases (IntArg,StrArg, ...) for kind signatures.sentinels-EMPTY/INVALIDand their guards.attributes- the attribute concerns (sort, cardinality, effects, execution).laws-LAWSand the predicate library.runtime-Runtime,Context,Budget, lifecycle helpers.helpers- top-level user-facing entries (run,eval,astream, ...).
A Term is built from the kind taxonomy, compiled against the schema,
then gated or validated, then driven through an entry.
Modules
| Module | What |
|---|---|
nu.lang.runtime | Runtime: how Nu programs run. |
kinds
Module nu.lang.kinds.
The Nu kind taxonomy: the user-facing Term classes that declare each sort.
| Name | Sort | Call | Meaning |
|---|---|---|---|
| Action | Action() | Abstract: a dual-citizen Interaction. Mutates Context and yields a value. | |
| Bracket | bracket | Bracket() | A Span that governs a body's lifecycle. |
| Command | scalar_command | Command() | A mutating Interaction. Yields nothing; its only sub-shape is scalar. |
| Control | control | Control() | A Flow that composes Commands under Query parameters. |
| Flow | Flow() | Abstract: a Command-composing Interaction. Yields nothing. | |
| Interaction | Interaction() | Abstract: a node that interacts with the Context. Never instantiated. | |
| Policy | policy | Policy() | A Span that governs a body's execution on failure. |
| Query | Query() | Abstract: a value-producing Interaction. | |
| Reduction | reduction | Reduction() | A ScalarQuery that folds a stream child down to one value. |
| ScalarAction | scalar_action | ScalarAction() | An Action that mutates and yields exactly one value. |
| ScalarQuery | scalar_query | ScalarQuery() | A Query that yields exactly one value. |
| Span | Span() | Abstract: a transparent Interaction; yields what its body yields. | |
| Strategy | strategy | Strategy() | A Flow that composes Commands directly. |
| StreamAction | stream_action | StreamAction() | An Action that mutates and yields zero or more values. |
| StreamQuery | stream_query | StreamQuery() | A Query that yields zero or more values. |
literal
Module nu.lang.literal.
Literal: wraps a raw Python value as a Nu term.
| Name | Sort | Call | Meaning |
|---|---|---|---|
| Literal | scalar_query | Literal(value) | A constant value wrapped as a term. |
forms
Module nu.lang.forms.
Form and TypedNu - the type-wrapping layer.
| Name | Sort | Call | Meaning |
|---|---|---|---|
| TypedNu | scalar_query | TypedNu() | Transparent ScalarQuery passthrough carrying a python type tag T. |
args
Module nu.lang.args.
Argument type aliases for Nu kind class signatures.
| Name | Call | Meaning |
|---|---|---|
| Arg | lang.Arg() | Create named, parameterized type aliases. |
| DictArg | lang.DictArg() | Create named, parameterized type aliases. |
| FrozenSetArg | lang.FrozenSetArg() | Create named, parameterized type aliases. |
| ListArg | lang.ListArg() | Create named, parameterized type aliases. |
| SetArg | lang.SetArg() | Create named, parameterized type aliases. |
| TupleArg | lang.TupleArg() | Create named, parameterized type aliases. |
helpers.evaluation
Module nu.lang.helpers.evaluation.
Drive entries: run a compiled Program through the Runtime.
| Name | Call | Meaning |
|---|---|---|
| acollect | lang.acollect(program, ctx=None, max_parallel=1) | Async sibling of collect. |
| aeval | lang.aeval(program, ctx=None, max_parallel=1) | Drive a Program asynchronously; return (value, ctx). |
| afirst | lang.afirst(program, ctx=None, max_parallel=1) | Async sibling of first. |
| alast | lang.alast(program, ctx=None, max_parallel=1) | Drain a stream-rooted Program and return the last item; (value, ctx). |
| collect | lang.collect(program, ctx=None, max_parallel=1) | Materialize a stream-rooted Program to a list; (values, ctx). |
| eval | lang.eval(program, ctx=None, max_parallel=1) | Drive a Program synchronously; return (value, ctx). |
| eval_in_loop | lang.eval_in_loop(program, ctx=None, max_parallel=1) | Drive an async-only Program from sync code by spinning a loop. |
| first | lang.first(program, ctx=None, max_parallel=1) | Return the first item of a stream-rooted Program; (value, ctx). |
helpers.run
Module nu.lang.helpers.run.
All-in-one entries: compile, validate, drive in one call.
| Name | Call | Meaning |
|---|---|---|
| arun | lang.arun(term, ctx=None, max_parallel=1) | Async sibling of run: compile, validate, then aeval. |
| run | lang.run(term, ctx=None, max_parallel=1) | Compile a Term, validate it, evaluate it; return (value, ctx). |
| run_in_loop | lang.run_in_loop(term, ctx=None, max_parallel=1) | Compile, validate, then drive on a fresh loop from sync code. |
attributes
Module nu.lang.attributes.
Nu's attributes: one module per concern, plus the schema that assembles them.
| Name | Call | Meaning |
|---|---|---|
| build_schema | lang.build_schema() | Build and finalize the Nu schema from every concern's attributes. |
helpers.compilation
Module nu.lang.helpers.compilation.
Nu-specialized compile: binds the finalized Nu SCHEMA.
| Name | Call | Meaning |
|---|---|---|
| compile | lang.compile(term) | Compile a Nu Term against the Nu schema; return a runnable Program. |
nu.engine.validation.law
Module nu.engine.validation.law.
Law: a declarative validity rule, plus the verdict primitives and runners.
| Name | Call | Meaning |
|---|---|---|
| gate | lang.gate(program) | Run every law over every node and return every Violation found. |
sentinels
Module nu.lang.sentinels.
Sentinels - EMPTY and INVALID.
| Name | Call | Meaning |
|---|---|---|
| is_empty | lang.is_empty(value) | True if value is the EMPTY sentinel. |
| is_invalid | lang.is_invalid(value) | True if value is the INVALID sentinel. |
| is_sentinel | lang.is_sentinel(value) | True if value is any Sentinel. |
attributes.sort
Module nu.lang.attributes.sort.
Sort attribute: the structural taxonomy of a Term.
| Name | Call | Meaning |
|---|---|---|
| matrix_sort | lang.matrix_sort(sort) | Resolve sort to the matrix sort it slot-fits as, or None. |
| subsort | lang.subsort(sort, ancestor) | Return whether sort is ancestor or descends from it in the tree. |
nu.engine.validation.predicate
Module nu.engine.validation.predicate.
Predicate: a composable (program, path) -> bool test.
| Name | Call | Meaning |
|---|---|---|
| predicate | lang.predicate(test) | Wrap a (program, path) -> bool function as a composable Predicate. |
helpers.validation
Module nu.lang.helpers.validation.
Nu-specialized validate: binds the Nu LAWS.
| Name | Call | Meaning |
|---|---|---|
| validate | lang.validate(program) | Validate a compiled Program against the Nu law set. |
typeinfo
Module nu.lang.typeinfo.
Recursive type info for shape slots.
| Name | Call | Meaning |
|---|---|---|
| value_type_for | lang.value_type_for(python_type) | Map a Python primitive type to its Form class (Any fallback). |