On Mon, 22 Jun 2009, reyssat wrote:
< Leo Butler a ?crit :
< > Is the documentation incorrect here, or this bug in make_array, or
< > between my ears? The other array types work as described.
< >
< > Leo
< > ----
< >
< > (%i5) ? make_array
< >
< > -- Function: make_array (<type>, <dim_1>, ..., <dim_n>)
< > Creates and returns a Lisp array. <type> may be `any', `flonum',
< > `fixnum', `hashed' or `functional'. There are n indices, and the
< > i'th index runs from 0 to <dim_i> - 1.
< >
< > (%i6) y : make_array('functional,4);
< >
< > make_array: not enough arguments for functional array specification.
< > -- an error. To debug this try debugmode(true);
< >
< >
< Hello,
<
< I have no reply to your question, but related comments.
<
< Just for information, the file ar.lisp (that I don't understand) implementing
< make_array contains a comment saying :
< " ;; Is FUNCTIONAL here an error?"
< So there might be a known bug.
Thanks.
<
< I think the documentation could also be more explicit about other options :
<
< - what are these options intended for ? The only difference between fixnum and
< flonum seems to be in the initialization (0 versus 0.0), but it seems possible
< to assing a float value to a fixnum array : is it right ? is it the same with
< the "any" option ?
I think that this reflects the fact that lisp is not a strongly typed
language, so these declarations are advice to the lisp compiler. You can
see this in lisp itself:
MAXIMA> (setf a (make-array 3 :element-type 'fixnum :initial-contents
'(0 0 0)))
#(0 0 0)
MAXIMA> (setf (aref a 0) 1.0)
1.0
MAXIMA> a
#(1.0 0 0)
I don't think this is any different from when you compile a function and the compiler
over-rides your statement in mode_declare.
Leo
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.