spec: vector primitives — bounds-checked ref/set!, vector-copy start/end slice

vector-ref and vector-set! now raise Eval_error on out-of-bounds index instead of
an OCaml array exception. vector-copy accepts optional start and end parameters for
slicing (R7RS §6.8). spec/primitives.sx doc updated to reflect slice params.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-25 19:27:54 +00:00
parent 3759575b29
commit d1a00562a4
3 changed files with 30 additions and 7 deletions

View File

@@ -227,9 +227,11 @@
(define-primitive
"vector-copy"
:params ((v :as vector))
:params ((v :as vector)
(start :as number :optional true)
(end :as number :optional true))
:returns "vector"
:doc "Independent shallow copy.")
:doc "Shallow copy of vector, optionally sliced from start (inclusive) to end (exclusive).")
(define-primitive
"min"