> Creating array is done by using make-array function.
>
> I am having trouble using a variable to set dimensions.
> for example
> (setf *test* 3)
> (setf *test-array* (make-array *test*)) ==> creates array with one
> dimension
> (setf *test-array* (make-array '(*test* *test*)) ==>> gives me an error
> saying that *test* is an illegal dimension.
>
> is there a way to get around this problem?
Sure.
(setf *test-array* (make-array (list *test* *test*)))
You need to understand the basic evaluation rules.
Consult your nearest Common Lisp manual.
Rainer Joswig, ISION Internet AG, Harburger Schlossstraße 1,
21079 Hamburg, Germany, Tel: +49 40 77175 226
Email: rainer...@ision.de , WWW: http://www.ision.de/
--
Barry Margolin, bar...@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
But if you issue make-array '(*test* *test*) then the quoted list ist not
evaluated and make-array receives as its arguments a list consisting of two
symbols instead of a list consisting of two numbers. Of course make-list
will not like that.
But be warned: I am learning Lisp myself and I am not sure that I am right.
Janos Blazi
Kee <k...@unforgettable.com> schrieb in im Newsbeitrag:
MyKr4.101613$A5.19...@news1.rdc1.bc.home.com...
> Creating array is done by using make-array function.
>
> I am having trouble using a variable to set dimensions.
> for example
> (setf *test* 3)
> (setf *test-array* (make-array *test*)) ==> creates array with one
> dimension
> (setf *test-array* (make-array '(*test* *test*)) ==>> gives me an error
> saying that *test* is an illegal dimension.
>
> is there a way to get around this problem?
>
> --
> Kee Nam.
> kn...@home.com
>
> --- Knowledge is Power -- Francis Bacon.
> --- Always Two There are... A Master and an Apprentice -- Yoda from Star
> Wars Episode I
>
>
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 80,000 Newsgroups - 16 Different Servers! =-----
Yes, twice. Fortunately it is a variable, so can evaluate it a million
times if you want.
> (2) the function list is called with two arguments and returns a list;
> this list is not evaluated
Correct. Lists are not passed to EVAL unless you explicitly ask.
> (3) the function make-array is called; the argument is the list returned
> by list.
>
> But if you issue make-array '(*test* *test*) then the quoted list is not
> evaluated and make-array receives as its arguments a list consisting of
two
> symbols instead of a list consisting of two numbers. Of course make-list
> will not like that.
I'd phrase it like this: If you call (make-array '(*test* *test*) ...),
remember
that '(*test* *test*) is simply shorthand for (quote (*test* *test*)). When
a quoted form is evaluated, the interpreter simply returns the object
quoted, i.e., the list with two references to the symbol *test*.
> But be warned: I am learning Lisp myself and I am not sure that I am
right.
Great so far!