length applied to vector -> crash

Dan <[email protected]>
Newsgroups gmane.comp.java.sisc.user
Message-ID <[email protected]>
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
        at sisc.env.LexicalUtils.fixLexicals(Unknown
Source)
        at sisc.exprs.LetrecExp.eval(Unknown Source)
        at
sisc.interpreter.Interpreter.interpret(Unknown Source)
        at
sisc.interpreter.Interpreter.interpret(Unknown Source)
        at sisc.interpreter.Interpreter.eval(Unknown
Source)
        at sisc.data.SchemeThread.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:595)

I couldn't simplify this any further without the bug
going away.


-- Dan

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com
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.