apl: :Trap exception machinery — Phase 7 complete (+5 tests, 450/450)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 1m8s

apl-throw raises a tagged ("apl-error" code msg) error.
apl-trap-matches? checks if codes list contains the error's code
(0 = catch-all, à la Dyalog).

Eval-stmt :trap clause wraps try-block with R7RS guard;
on match, runs catch-block; on mismatch, re-raises.
Bonus :throw AST node for testing.

test.sh + conformance.sh now load lib/r7rs.sx (for guard) and
include eval-ops + pipeline suites in scoreboard.

All Phase 7 unchecked items are now ticked.
Final scoreboard: 450/450 across 10 suites.
This commit is contained in:
2026-05-07 14:53:22 +00:00
parent 67ff2a3ae8
commit 0dd2fa3058
8 changed files with 74 additions and 11 deletions

View File

@@ -971,6 +971,20 @@
(define apl-quad-print (fn (arr) arr))
(define apl-throw (fn (code msg) (raise (list "apl-error" code msg))))
(define
apl-trap-matches?
(fn
(codes e)
(and
(list? e)
(>= (len e) 2)
(= (first e) "apl-error")
(or
(some (fn (c) (= c 0)) codes)
(some (fn (c) (= c (nth e 1))) codes)))))
(define
apl-reduce
(fn