Re: length applied to vector -> crash

Matthias Radestock <[email protected]>
Newsgroups gmane.comp.java.sisc.user
Message-ID <[email protected]>
Dan <[email protected]> writes:

> Here's what happens when you apply (length) to a
> vector:
>
>   (define (vec-rev-for-each p v)
>     (define l (length v))
>     (do ((i (- l 1) (- i 1))) ((< i 0) #t)
>       (p i (vector-ref v i))))
>
> #;> (vec-rev-for-each '#(1 2 3) values)
> Exception in thread "Thread-2"
> java.lang.ArrayIndexOutOfBoundsException: 1
>
> [...]
>
> I couldn't simplify this any further without the bug
> going away.

Ouch. Well spotted! Please file a bug.

Btw, this has nothing to do with applying length to a vector. If you
replace the 'length' in your example with, say, 'car', the error still
happens.


Matthias.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.