#328 Mistake in LISP tutorial

doc (11)
Ronald BG.

I think I have found a mistake in the LISP tutorial included with GNU CLISP distributions:

Excerpt from line 711-722 of the tutorial:
> (setf a (make-array 1)) ;setf on a variable is equivalent to setq
> (push 5 (aref a 1)) ;push can act like setf ;???
> (pop (aref a 1)) ;so can pop
> (setf (aref a 1) 5)
> (incf (aref a 1)) ;incf reads from a place, increments,
6 ;and writes back
> (aref a 1)

I think all the "(aref a 1)" forms above are wrong: Because we created array with one element, the only valid array index is zero; accessing index 1 (with the form "(aref a 1)") will result in an error.


  • Sam Steingold

    Sam Steingold - 2006-03-29

    Logged In: YES

    thank you for your bug report.
    the bug has been fixed in the CVS tree.
    you can either wait for the next release (recommended)
    or check out the current CVS tree (see http://clisp.cons.org\)
    and build CLISP from the sources (be advised that between
    releases the CVS tree is very unstable and may not even build
    on your platform).

  • Sam Steingold

    Sam Steingold - 2006-03-29
    • assigned_to: haible --> sds
    • status: open --> closed-fixed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks