jim@wvlink.mpl.com (Jim Poling) writes:
>I get an error with the following piece of code. Can I not use a
>variable in a multi-dimensional array definition?
>
>to test
>make "pointc 433
>print :pointc
>make "dumarray (mdarray [:pointc 3] 0)
>show :dumarray
>end
The problem has nothing to do with mdarray; you are misunderstanding
how to construct a list in Logo.
When you put things in square brackets, you are creating a LITERAL
(a/k/a QUOTED) list; the values in the list are exactly the words
you type. So in your list [:pointc 3] the first element is not
"the value of the variable named pointc" but rather "the seven-letter
word colon, p, o, i..."
The way to create a list whose contents vary is to use the LIST
operation: instead of [:pointc 3] you say
list :pointc 3
So you could say
make "dumarray (mdarray (list :pointc 3) 0)
and your program will work as desired.
---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org. Mail
questions about the list administration to logofdn@gsn.org. To
unsubscribe send unsubscribe logo-l to majordomo@gsn.org.