From: Lynn Quam <quam@ai...> - 2002-03-10 21:34:54
CMUCL, and by inheritance SBCL, are the only Lisp implmentations I am
aware of that by default initialize arrays of element-type T to 0
rather than NIL.
(aref (make-array 1) 0) return 0.
Was there any rationale for this choice?
(ACL was previously very broken for numeric arrays: if no
initial-element (or initial-contents) was specified, it didn't even
bother to initialize the array. This appears to have been fixed
From: Paul Werkowski <pw@sn...> - 2002-03-11 01:06:23
| CMUCL, and by inheritance SBCL, are the only Lisp implmentations I am
| aware of that by default initialize arrays of element-type T to 0
| rather than NIL.
| (aref (make-array 1) 0) return 0.
| Was there any rationale for this choice?
I was not around when that "choice" was made. However, it seems to me
to be a reasonable result. The spec does not require any particular value
and what we get is just an artifact of doing nothing. That is, the newly
allocated memory happens to be binary zero.
Use the :initial-element argument to make-array if you want to portably
specify the initial element value.