Re: subseq behaviour if end is out of range? not an error for vectors
Shiro Kawai <[email protected]> Thu, 7 May 2026 23:51:05 -1000
| Newsgroups | gmane.lisp.scheme.gauche |
|---|---|
| Message-ID | <CALN0JNGmEeFwiW3wRLbTt9MYJU-=fX+zkyso-2d2prH8ryUDvQ@mail.gmail.com> |
--===============0786281381050876848== Content-Type: multipart/alternative; boundary="00000000000087683a06514b5681" --00000000000087683a06514b5681 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I think that's due to my sloppiness. I think it should raise an error, for the silently returning garbage is worse. On Thu, May 7, 2026 at 9:09=E2=80=AFPM Jens Thiele <[email protected]> wrote: > 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 > > > _______________________________________________ > Gauche-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/gauche-devel > --00000000000087683a06514b5681 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-size:large">I t= hink that's due to my sloppiness.=C2=A0 I think it should raise an erro= r, for the silently returning garbage is worse.</div><div class=3D"gmail_de= fault" style=3D"font-size:large"><br></div><div class=3D"gmail_default" sty= le=3D"font-size:large"><br></div></div><br><div class=3D"gmail_quote gmail_= quote_container"><div dir=3D"ltr" class=3D"gmail_attr">On Thu, May 7, 2026 = at 9:09=E2=80=AFPM Jens Thiele <<a href=3D"mailto:[email protected]">karme@= karme.de</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D= "margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-le= ft:1ex">Hi,<br> <br> The manual doesn't define the behaviour of subseq if end is out of rang= e<br> but I was suprised by the behaviour with vectors:<br> $ src/gosh -ftest -V<br> Gauche scheme shell, version 0.9.16_pre2 [utf-8,pthreads], x86_64-pc-linux-= gnu<br> (version "0.9.16_pre2")<br> (command "gosh")<br> (<a href=3D"http://scheme.id" rel=3D"noreferrer" target=3D"_blank">scheme.i= d</a> gauche)<br> (languages scheme r5rs r7rs)<br> (encodings utf-8)<br> (website "<a href=3D"https://practical-scheme.net/gauche" rel=3D"noref= errer" target=3D"_blank">https://practical-scheme.net/gauche</a>")<br> (build.platform "x86_64-pc-linux-gnu")<br> (build.configure)<br> (build.gosh-version "0.9.16_pre2")<br> (scheme.path "/tmp/Gauche/src/../lib" "/tmp/Gauche/src/../li= bsrc" "/tmp/Gauche/src/../src" "/usr/local/share/gauche= -0.98/site/lib" "/usr/local/share/gauche-0.98/0.9.16_pre2/lib&quo= t;)<br> (threads pthreads)<br> (gauche.net.tls)<br> $ src/gosh -ftest<br> gosh$ (use gauche.sequence)<br> gosh$ (use gauche.uvector)<br> gosh$ (subseq '(0) 0 2)<br> *** ASSERTION-VIOLATION: v is supposed to be of type pair, but got ()<br> Stack Trace:<br> _______________________________________<br> =C2=A0 0=C2=A0 (report-error e)<br> =C2=A0 1=C2=A0 (next)<br> =C2=A0 2=C2=A0 (add! (next))<br> =C2=A0 3=C2=A0 (eval expr env)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 at "/tmp/Gauche/src/../lib/gauche/interact= ive.scm":407<br> =C2=A0 4=C2=A0 (evaluator exp (vm-current-module))<br> =C2=A0 5=C2=A0 (with-error-handler (^e (report-error e) #t) (^ () (let loop= 2 ...<br> gosh$ (subseq #u8(0) 0 2)<br> *** ERROR: end argument out of range: 2<br> Stack Trace:<br> _______________________________________<br> =C2=A0 0=C2=A0 (report-error e)<br> =C2=A0 1=C2=A0 (eval expr env)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 at "/tmp/Gauche/src/../lib/gauche/interact= ive.scm":407<br> =C2=A0 2=C2=A0 (evaluator exp (vm-current-module))<br> =C2=A0 3=C2=A0 (with-error-handler (^e (report-error e) #t) (^ () (let loop= 2 ...<br> gosh$ (subseq #*0 0 2)<br> *** ERROR: end argument out of range: 2<br> Stack Trace:<br> _______________________________________<br> =C2=A0 0=C2=A0 (report-error e)<br> =C2=A0 1=C2=A0 (eval expr env)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 at "/tmp/Gauche/src/../lib/gauche/interact= ive.scm":407<br> =C2=A0 2=C2=A0 (evaluator exp (vm-current-module))<br> =C2=A0 3=C2=A0 (with-error-handler (^e (report-error e) #t) (^ () (let loop= 2 ...<br> gosh$ (subseq #(0) 0 2)<br> #(0 #<undef>)<br> <br> jens<br> <br> <br> _______________________________________________<br> Gauche-devel mailing list<br> <a href=3D"mailto:[email protected]" target=3D"_blank">Gau= [email protected]</a><br> <a href=3D"https://lists.sourceforge.net/lists/listinfo/gauche-devel" rel= =3D"noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/listi= nfo/gauche-devel</a><br> </blockquote></div> --00000000000087683a06514b5681-- --===============0786281381050876848== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============0786281381050876848== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Gauche-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gauche-devel --===============0786281381050876848==--