code wiki / (root) / nx_primitive_registry.nx

nx_primitive_registry.nx

buildroot/runtime/nx_primitive_registry.nx

6419 B173 linesdepth 6pulls 6 transitivereach 3 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_primitive_registry.nx -- callable-by-name primitive catalog. Per user 2026-05-15: "actually ingest and use all the algorithms known as primitives as callable elements like functions like other systems". THE PATTERN (NumPy / SciPy / Mathematica / MATLAB): - Every primitive has a stable name (string) - The catalog records (name, signature_id, domain, complexity, provenance), enabling discovery and introspection - Lookup-by-name returns a stable IntID; downstream code dispatches by ID for performance - Per-domain query lets the user enumerate "what physics primitives are available?" NOTE: NishiLang doesn't yet have first-class function pointers in the user-source surface, so the registry stores METADATA + a stable dispatch_id. Caller chooses to invoke by direct symbol name (the fast path -- L3 callable) OR via the dispatcher (the slow but uniform path). Adding first-class fn pointers is a named blocker for full Mathematica-style Symbolic[] dispatch and is on the compiler-improvements queue.

dependencies 1 imports · 1 importers

nx_kernel_v2.nx nx_primitive_registry.nx nx_capabilities_test.nx

imports: nx_kernel_v2.nx

imported by: nx_capabilities_test.nx

structs

62struct PrimEntry
73struct PrimRegistry

consts

33const NX_DOMAIN_LOGIC: nx_int = 1 // kernel rules + propositional engine
34const NX_DOMAIN_ARITH: nx_int = 2 // nat / int / rat / real Term substrate
35const NX_DOMAIN_LINALG: nx_int = 3 // vec / matrix
36const NX_DOMAIN_CALC: nx_int = 4 // symbolic derivative / integral
37const NX_DOMAIN_PHYSICS: nx_int = 5 // units + dim analysis + dynamics
38const NX_DOMAIN_CHEM: nx_int = 6 // atomic table + stoichiometry
39const NX_DOMAIN_PROB: nx_int = 7 // probability + statistics
40const NX_DOMAIN_PROOF: nx_int = 8 // proof construction (engine + tactics)
41const NX_DOMAIN_RENDER: nx_int = 9 // visual output (CLI + browser)
42const NX_DOMAIN_DATA: nx_int = 10 // sketches / hashes / encodings
45const NX_COMPLEX_O1: nx_int = 1
46const NX_COMPLEX_O_LOG_N: nx_int = 2
47const NX_COMPLEX_O_N: nx_int = 3
48const NX_COMPLEX_O_N_LOG_N: nx_int = 4
49const NX_COMPLEX_O_N2: nx_int = 5
50const NX_COMPLEX_O_N3: nx_int = 6
51const NX_COMPLEX_O_2N: nx_int = 7
52const NX_COMPLEX_NP: nx_int = 8
58const NX_PRIM_PROVED_NATIVE: nx_int = 0
59const NX_PRIM_PENDING: nx_int = 1
71const NX_PRIM_BYTES: nx_int = 56
78const NX_PRIM_REG_BYTES: nx_int = 24

functions

80func nx_prim_registry_new(cap: nx_int) -> *PrimRegistry
88func nx_prim_at(r: *PrimRegistry, i: nx_int) -> *PrimEntry
93func nx_prim_register(
116func nx_prim_lookup(r: *PrimRegistry, name: *u8, name_len: nx_int) -> nx_int
called by 1: t1_registry calls 1: nx_prim_at
137func nx_prim_count_by_domain(r: *PrimRegistry, domain: nx_int) -> nx_int
149func nx_prim_count_by_status(r: *PrimRegistry, status: nx_int) -> nx_int
called by 1: t1_registry calls 1: nx_prim_at
161func nx_prim_domain_name(d: nx_int) -> *u8