From: Janos Blazi
Subject: Re: creating an arry(more than one dimension) with a variable.
Date: 
Message-ID: <38b224d2_5@goliath.newsfeeds.com>
I think,
if you call make-array (list *test* *test*) then
  (1) *test* is evaluated (probably twice, I am not sure)
  (2) the function list is called with two arguments and returns a list;
        this list is not evaluated
  (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 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 <···@unforgettable.com> schrieb in im Newsbeitrag:
·······················@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.
> ····@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! =-----
From: Joe Marshall
Subject: Re: creating an arry(more than one dimension) with a variable.
Date: 
Message-ID: <Pkxs4.58239$vi4.123182@dfw-read.news.verio.net>
Janos Blazi <······@netsurf.de> wrote in message
···············@goliath.newsfeeds.com...
> I think,
> if you call make-array (list *test* *test*) then
>   (1) *test* is evaluated (probably twice, I am not sure)

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!