subseq behaviour if end is out of range? not an error for vectors

Jens Thiele <[email protected]> Fri, 08 May 2026 09:09:02 +0200
Newsgroups gmane.lisp.scheme.gauche
Message-ID <[email protected]>
Hi,

The manual doesn't define the behaviour of subseq if end is out of range
but I was suprised by the behaviour with vectors:
$ src/gosh -ftest -V
Gauche scheme shell, version 0.9.16_pre2 [utf-8,pthreads], x86_64-pc-linux-gnu
(version "0.9.16_pre2")
(command "gosh")
(scheme.id gauche)
(languages scheme r5rs r7rs)
(encodings utf-8)
(website "https://practical-scheme.net/gauche")
(build.platform "x86_64-pc-linux-gnu")
(build.configure)
(build.gosh-version "0.9.16_pre2")
(scheme.path "/tmp/Gauche/src/../lib" "/tmp/Gauche/src/../libsrc" "/tmp/Gauche/src/../src" "/usr/local/share/gauche-0.98/site/lib" "/usr/local/share/gauche-0.98/0.9.16_pre2/lib")
(threads pthreads)
(gauche.net.tls)
$ src/gosh -ftest
gosh$ (use gauche.sequence)
gosh$ (use gauche.uvector)
gosh$ (subseq '(0) 0 2)
*** ASSERTION-VIOLATION: v is supposed to be of type pair, but got ()
Stack Trace:
_______________________________________
  0  (report-error e)
  1  (next)
  2  (add! (next))
  3  (eval expr env)
        at "/tmp/Gauche/src/../lib/gauche/interactive.scm":407
  4  (evaluator exp (vm-current-module))
  5  (with-error-handler (^e (report-error e) #t) (^ () (let loop2 ...
gosh$ (subseq #u8(0) 0 2)
*** ERROR: end argument out of range: 2
Stack Trace:
_______________________________________
  0  (report-error e)
  1  (eval expr env)
        at "/tmp/Gauche/src/../lib/gauche/interactive.scm":407
  2  (evaluator exp (vm-current-module))
  3  (with-error-handler (^e (report-error e) #t) (^ () (let loop2 ...
gosh$ (subseq #*0 0 2)
*** ERROR: end argument out of range: 2
Stack Trace:
_______________________________________
  0  (report-error e)
  1  (eval expr env)
        at "/tmp/Gauche/src/../lib/gauche/interactive.scm":407
  2  (evaluator exp (vm-current-module))
  3  (with-error-handler (^e (report-error e) #t) (^ () (let loop2 ...
gosh$ (subseq #(0) 0 2)
#(0 #<undef>)

jens