phase-22 APL: runtime.sx vectors/bitwise/sets/reduce/format
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 34s

lib/apl/runtime.sx (60 forms):
- Core: apl-iota (1..N), apl-rho (shape), apl-at (1-indexed access).
- Rank-polymorphic apl-dyadic/apl-monadic helpers: scalar×scalar,
  scalar×vector, vector×vector all supported uniformly.
- Arithmetic: add/sub/mul/div/mod/pow/max/min, neg/abs/floor/ceil/sqrt.
- Comparison: eq/neq/lt/le/gt/ge → 0/1 result vectors.
- Boolean: and/or/not on 0/1 values, element-wise.
- Bitwise: bitand/bitor/bitxor/bitnot/lshift/rshift — element-wise.
- Reduction: reduce-add/mul/max/min/and/or; scan-add/mul.
- Vector ops: reverse, cat (scalar/vector catenate), take (±N), drop (±N),
  rotate, compress (boolean mask), index (multi-index).
- Set ops: member (∊, → 0/1), nub (∪, unique preserve-order),
  union, intersect (∩), without (~). All use SX make-set internally.
- Format (⍕): vector → space-separated string, scalar → str.

lib/apl/tests/runtime.sx + lib/apl/test.sh: 73/73 pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-01 22:49:38 +00:00
parent 077f4a5d38
commit 912de5a274
4 changed files with 670 additions and 1 deletions

View File

@@ -698,8 +698,9 @@ Brief each language's loop agent (or do inline) after rebasing their branch onto
`Set new`; char type for `Character`; string ports + `read`/`write` for `printString`.
lib/smalltalk/runtime.sx (72 forms) + tests/runtime.sx (86/86 pass). COMMIT.
- [ ] APL: vectors as core array type; bitwise ops for array masks; sets for APL set ops;
- [x] APL: vectors as core array type; bitwise ops for array masks; sets for APL set ops;
sequence protocol for rank-polymorphic operations; format for APL output formatting.
lib/apl/runtime.sx (60 forms) + tests/runtime.sx (73/73 pass). COMMIT.
- [ ] Ruby: coroutines for fibers; hash tables for `Hash`; sets for `Set`; regexp for
Ruby regex; string ports for `StringIO`; bytevectors for `String` binary encoding.
@@ -726,6 +727,7 @@ Brief each language's loop agent (or do inline) after rebasing their branch onto
_Newest first._
- 2026-05-01: Phase 22 APL done — runtime.sx (60 forms): iota/rho/at, rank-polymorphic dyadic/monadic helpers, arithmetic/comparison/boolean/bitwise element-wise, reduce/scan, take/drop/rotate/compress/index, set ops (member/nub/union/intersect/without), format. 73/73 tests. COMMIT.
- 2026-05-01: Phase 22 Smalltalk done — runtime.sx (72 forms): numeric helpers, Character (1-indexed Array backed by dict), Dictionary (list-of-pairs any-key map), Set (make-set), WriteStream/ReadStream/printString. set-member? (set item) order. 86/86 tests. COMMIT.
- 2026-05-01: Phase 22 JS done — stdlib.sx (36 forms): bitwise (truncate not js-num-to-int; set-member? takes (set item) order), Map (dict-backed pairs), Set (SX make-set), RegExp (callable lambda). 25/25 new tests pass; total 492/585. COMMIT.
- 2026-05-01: Phase 22 Haskell done — runtime.sx (113 forms): numeric tower (hk-div floor semantics), rational (dict GCD-normalised), hk-force (promises), Data.Char, Data.Set, Data.List, Maybe/Either, tuples, string helpers, hk-show. 148/148 tests. c02ffcf3.