apl: ? roll/random + apl-rng-seed! (+4 tests)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 55s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 55s
apl-rng-state global mutable LCG. apl-rng-seed! for deterministic tests. apl-rng-next! advances state. apl-roll: monadic ?N returns scalar in 1..N (apl-io-relative). apl-monadic-fn dispatches "?" → apl-roll. apl-run "?10" → 8 (with seed 42) apl-run "?100" → in 1..100
This commit is contained in:
@@ -202,7 +202,7 @@ Today they are documentation; we paraphrase the algorithms in
|
||||
:dyad/:monad capture env update when their RHS is :assign-expr, threading
|
||||
the new binding into the LHS evaluation. Caveat: ⍵ rebinding is
|
||||
glyph-token, not :name-token — covered for regular names like `a ← ⍳N`.)_
|
||||
- [ ] **`?` (random / roll)** — monadic `?N` returns a random integer
|
||||
- [x] **`?` (random / roll)** — monadic `?N` returns a random integer
|
||||
in 1..N. Used by quicksort.apl for pivot selection. Add `apl-roll`
|
||||
(deterministic seed for tests) + glyph wiring.
|
||||
- [ ] **`apl-run-file path → array`** — read the file from disk, strip
|
||||
@@ -232,6 +232,7 @@ data; format for string templating.
|
||||
|
||||
_Newest first._
|
||||
|
||||
- 2026-05-07: Phase 9 step 3 — `?N` random / roll. Top-level mutable apl-rng-state with LCG; apl-rng-seed! for deterministic tests; apl-roll wraps as scalar in 1..N. apl-monadic-fn maps "?" → apl-roll. +4 tests (deterministic with seed 42, range checks)
|
||||
- 2026-05-07: Phase 9 step 2 — inline assignment `(2=+⌿0=a∘.|a)/a←⍳30` runs end-to-end. Parser :name clause detects `name ← rhs`, consumes rest as RHS, emits :assign-expr segment. Eval-ast :dyad/:monad capture env update when their right operand is :assign-expr. +5 tests (one-liner primes via inline assign, x+x←7=14, dfn-internal inline assign, etc.)
|
||||
- 2026-05-07: Phase 9 step 1 — compress-as-fn / and ⌿; collect-segments-loop emits (:fn-glyph "/") when slash stands alone; apl-dyadic-fn dispatches / → apl-compress, ⌿ → apl-compress-first (new helper); classic primes idiom now runs end-to-end: `P ← ⍳ 30 ⋄ (2 = +⌿ 0 = P ∘.| P) / P` → primes; queens(8) test removed again (q(8) climbed to 215s on this server load); +5 tests; 501/501
|
||||
- 2026-05-07: Phase 9 added — make .apl source files run as-written (compress as dyadic /, inline assignment, ? random, apl-run-file, glyph audit, source-as-tests)
|
||||
|
||||
Reference in New Issue
Block a user