Add spec/stdlib.sx: 46 primitives become library functions
The irreducible primitive set drops from 79 to 33. Everything that can be expressed in SX is now a library function in stdlib.sx, loaded after evaluator.sx and before render.sx. Moved to stdlib.sx (pure SX, no host dependency): - Logic: not - Comparison: != <= >= eq? eqv? equal? - Predicates: nil? boolean? number? string? list? dict? continuation? empty? odd? even? zero? contains? - Arithmetic: inc dec abs ceil round min max clamp - Collections: first last rest nth cons append reverse flatten range chunk-every zip-pairs vals has-key? merge assoc dissoc into - Strings: upcase downcase string-length substring string-contains? starts-with? ends-with? split join replace - Text: pluralize escape assert parse-datetime Remaining irreducible primitives (33): + - * / mod floor pow sqrt = < > type-of symbol-name keyword-name str slice index-of upper lower trim char-from-code list dict concat get len keys dict-set! append! random-int json-encode format-date parse-int format-decimal strip-tags sx-parse error apply All hosts: JS 957+1080, Python 744, OCaml 952 — zero regressions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1640,6 +1640,7 @@ SPEC_MODULES = {
|
||||
"engine": ("engine.sx", "engine (fetch/swap/trigger pure logic)"),
|
||||
"signals": ("signals.sx", "signals (reactive signal runtime)"),
|
||||
"page-helpers": ("page-helpers.sx", "page-helpers (pure data transformation helpers)"),
|
||||
"stdlib": ("stdlib.sx", "stdlib (library functions from former primitives)"),
|
||||
"types": ("types.sx", "types (gradual type system)"),
|
||||
"freeze": ("freeze.sx", "freeze (serializable state boundaries)"),
|
||||
"content": ("content.sx", "content (content-addressed computation)"),
|
||||
@@ -1647,9 +1648,10 @@ SPEC_MODULES = {
|
||||
# Note: frames and cek are now part of evaluator.sx (always loaded as core)
|
||||
|
||||
# Explicit ordering for spec modules with dependencies.
|
||||
# stdlib must come first — other modules use its functions.
|
||||
# freeze depends on signals; content depends on freeze.
|
||||
SPEC_MODULE_ORDER = [
|
||||
"deps", "engine", "page-helpers", "router", "signals", "types", "freeze", "content",
|
||||
"stdlib", "deps", "engine", "page-helpers", "router", "signals", "types", "freeze", "content",
|
||||
]
|
||||
|
||||
EXTENSION_NAMES = {"continuations"}
|
||||
|
||||
Reference in New Issue
Block a user