b661318a45
apl: train/fork notation (f g h) and (g h) (+6 tests, 496/496)
...
Test, Build, and Deploy / test-build-deploy (push) Failing after 57s
Parser: when a parenthesised subexpression contains only function
segments (>= 2), collect-segments-loop now emits a :train AST node
instead of treating it as a value-producing expression.
Resolver: apl-resolve-{monadic,dyadic} handle :train.
- monadic 2-train (atop): (g h)⍵ = g (h ⍵)
- monadic 3-train (fork): (f g h)⍵ = (f ⍵) g (h ⍵)
- dyadic 2-train: ⍺(g h)⍵ = g (⍺ h ⍵)
- dyadic 3-train: ⍺(f g h)⍵ = (⍺ f ⍵) g (⍺ h ⍵)
apl-run "(+/÷≢) 1 2 3 4 5" → 3 (mean)
apl-run "(- ⌊) 5" → -5 (atop)
apl-run "2 (+ × -) 5" → -21 (dyadic fork)
apl-run "(⌈/-⌊/) 3 1 4 …" → 8 (range)
2026-05-07 19:02:17 +00:00
c04f38a1ba
apl: multi-axis bracket A[I;J] / A[I;] / A[;J] (+8 tests, 475/475)
...
Test, Build, and Deploy / test-build-deploy (push) Failing after 50s
Parser: split-bracket-content splits inner tokens on :semi at
depth 0; maybe-bracket emits (:bracket arr axis-exprs...) for
multi-axis access, with :all marker for empty axes.
Runtime: apl-bracket-multi enumerates index combinations via
apl-cartesian (helper) and produces sub-array. Scalar axes
collapse from result shape; vector / nil axes contribute their
length.
apl-run "M ← (3 3) ⍴ ⍳9 ⋄ M[2;2]" → 5
apl-run "M ← (3 3) ⍴ ⍳9 ⋄ M[1;]" → 1 2 3
apl-run "M ← (3 3) ⍴ ⍳9 ⋄ M[;2]" → 2 5 8
apl-run "M ← (2 3) ⍴ ⍳6 ⋄ M[1 2;1 2]" → 2x2 sub-block
2026-05-07 17:56:24 +00:00
b13819c50c
apl: named function definitions f ← {…} (+7 tests, 467/467)
...
Test, Build, and Deploy / test-build-deploy (push) Failing after 53s
Parser: apl-collect-fn-bindings pre-scans stmt-groups for
`name ← { ... }` patterns and populates apl-known-fn-names.
is-fn-tok? consults this list; collect-segments-loop emits
(:fn-name nm) for known names so they parse as functions.
Resolver: apl-resolve-{monadic,dyadic} handle :fn-name by
looking up env, asserting the binding is a dfn, returning
a closure that dispatches to apl-call-dfn{-m,}.
Recursion still works: `fact ← {0=⍵:1 ⋄ ⍵×∇⍵-1} ⋄ fact 5` → 120.
2026-05-07 17:33:41 +00:00
d9cf00f287
apl: quick-wins bundle — decimals + ⎕← + strings (+10 tests, 460/460)
...
Test, Build, and Deploy / test-build-deploy (push) Failing after 49s
Three small unblockers in one iteration:
- tokenizer: read-digits! now consumes optional ".digits" suffix,
so 3.7 and ¯2.5 are single number tokens.
- tokenizer: ⎕ followed by ← emits a single :name "⎕←" token
(instead of splitting on the assign glyph). Parser registers
⎕← in apl-quad-fn-names; apl-monadic-fn maps to apl-quad-print.
- eval-ast: :str AST nodes evaluate to char arrays. Single-char
strings become rank-0 scalars; multi-char become rank-1 vectors
of single-char strings.
2026-05-07 17:26:37 +00:00
aaabe370d6
apl: bracket indexing A[I] → (I⌷A) (+7 tests, 415/415)
...
Test, Build, and Deploy / test-build-deploy (push) Failing after 1m29s
Parser: maybe-bracket helper wraps any value followed by [expr]
into (:dyad (:fn-glyph ⌷) idx val). Wired into :name and :lparen
branches of collect-segments-loop.
apl-run "(10 20 30)[2]" → 20
apl-run "A ← 100 200 300 ⋄ A[2]" → 200
apl-run "(⍳5)[3] × 7" → 21
Multi-axis A[I;J] deferred — needs semicolon-split parsing.
2026-05-07 14:07:05 +00:00
637ba4102f
apl: ⎕ quad-names end-to-end (+8 tests, 408/408)
...
Test, Build, and Deploy / test-build-deploy (push) Failing after 1m4s
Parser: apl-quad-fn-names list; is-fn-tok? + :name clause
in collect-segments-loop now route ⎕FMT through fn pipeline.
Eval-ast: :name branch dispatches ⎕IO/⎕ML/⎕FR/⎕TS to apl-quad-*
niladics; apl-monadic-fn handles ⎕FMT.
⎕← (print) deferred — tokenizer splits ⎕← into name + :assign.
2026-05-07 13:49:35 +00:00
7cf8b74d1d
apl: end-to-end pipeline apl-run + 25 source-string tests (400/400)
...
Test, Build, and Deploy / test-build-deploy (push) Failing after 1m7s
apl-run = parse-apl + apl-eval-ast against empty env. Wires
tokenizer + parser + transpile + runtime as one entry point.
test.sh now loads tokenizer.sx + parser.sx alongside transpile.sx.
Source-string tests cover scalars, strands, dyadic arith,
right-to-left precedence, monadic primitives, /, \, ⌈/, ×/,
∘.×, +.×, ⍴, comparisons, classic one-liners.
Tokenizer doesn't yet handle decimal literals (3.7 → 3 . 7),
so two such tests substituted with integer min/max-reduce.
2026-05-07 13:17:39 +00:00