apl: ? roll/random + apl-rng-seed! (+4 tests)
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:
2026-05-07 22:19:57 +00:00
parent 0b3610a63a
commit bcdd137d6f
4 changed files with 46 additions and 1 deletions

View File

@@ -39,6 +39,7 @@
((= g "⊖") apl-reverse-first)
((= g "⍋") apl-grade-up)
((= g "⍒") apl-grade-down)
((= g "?") apl-roll)
((= g "⎕FMT") apl-quad-fmt)
((= g "⎕←") apl-quad-print)
(else (error "no monadic fn for glyph")))))