Files
rose-ash/lib/apl
giles 0b3610a63a
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 1m2s
apl: inline assignment a ← rhs mid-expression (+5 tests)
Parser: :name clause now detects 'name ← rhs' patterns inside
expressions. When seen, consumes the remaining tokens as RHS,
parses recursively, and emits a (:assign-expr name parsed-rhs)
value segment.

Eval-ast :dyad and :monad: when the right operand is an
:assign-expr node, capture the binding into env before
evaluating the left operand.  This realises the primes idiom:

  apl-run "(2 = +⌿ 0 = a ∘.| a) / a ← ⍳ 30"
  → 2 3 5 7 11 13 17 19 23 29

Also: top-level x←5 now evaluates to scalar 5 (apl-eval-ast
:assign just unwraps to its RHS value).

Caveat: ⍵-rebinding (the original primes.apl uses
'⍵←⍳⍵') is a :glyph-token; only :name-tokens are handled.
A regular variable name (like 'a') works.
2026-05-07 21:52:33 +00:00
..