apl: bracket indexing A[I] → (I⌷A) (+7 tests, 415/415)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 1m29s
Some checks failed
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.
This commit is contained in:
@@ -123,9 +123,10 @@ and tightens loose ends.
|
||||
`⎕name`, then handle in `apl-eval-ast` by dispatching to `apl-quad-*`
|
||||
runtime fns (`⎕IO`, `⎕ML`, `⎕FR`, `⎕TS`, `⎕FMT`, `⎕←`).
|
||||
_(`⎕←` deferred — tokenizer treats `←` as `:assign` after `⎕`.)_
|
||||
- [ ] **Bracket indexing verification** — load programs that use `A[I]` /
|
||||
- [x] **Bracket indexing verification** — load programs that use `A[I]` /
|
||||
`A[I;J]` end-to-end; confirm parser desugars to `⌷` and runtime returns
|
||||
expected slices. Add 5+ tests.
|
||||
_(Single-axis only — multi-axis `A[I;J]` requires semicolon parsing, deferred.)_
|
||||
- [ ] **Idiom corpus expansion** — extend `idioms.sx` from 34 to 60+ once
|
||||
end-to-end works (we can express idioms as APL strings, not as runtime
|
||||
calls). Source-string-based idioms validate the whole stack.
|
||||
@@ -148,6 +149,7 @@ data; format for string templating.
|
||||
|
||||
_Newest first._
|
||||
|
||||
- 2026-05-07: Phase 7 step 4 — bracket indexing `A[I]` desugared to `(:dyad ⌷ I A)` via maybe-bracket helper, wired into :name + :lparen branches of collect-segments-loop; multi-axis (A[I;J]) deferred (semicolon split); +7 tests; 415/415
|
||||
- 2026-05-07: Phase 7 step 3 — :quad-name end-to-end; tokenizer already produced :name "⎕FMT"; parser is-fn-tok? extended via apl-quad-fn-names; eval-ast :name dispatches ⎕IO/⎕ML/⎕FR/⎕TS to apl-quad-*; apl-monadic-fn handles ⎕FMT; ⎕← deferred (tokenizer splits ⎕←); +8 tests; 408/408
|
||||
- 2026-05-07: Phase 7 step 2 — end-to-end pipeline `apl-run : string → array` (parse-apl + apl-eval-ast against empty env); +25 source-string tests covering scalars, strands, dyadic arith, monadic primitives, operators, ∘./.g products, comparisons, famous one-liners (+/⍳10=55, ×/⍳10=10!); tokenizer can't yet parse decimals so `3.7` literal tests dropped; **400/400**
|
||||
- 2026-05-07: Phase 7 step 1 — operators in apl-eval-ast via apl-resolve-monadic/dyadic; supports / ⌿ \ ⍀ ¨ ⍨ ∘. f.g; queens(8) test removed (too slow for 300s timeout); +14 eval-ops tests; 375/375
|
||||
|
||||
Reference in New Issue
Block a user