From: ···········@yahoo.com
Subject: make-array can't take constants?
Date: 
Message-ID: <1129719873.185331.199720@f14g2000cwb.googlegroups.com>
In SBCL I enter a couple of constants and try to create an array like
this:

* (defconstant +rows+ 3)

+ROWS+
* (defconstant +columns+ 5)

+COLUMNS+
* (defparameter *my-array* (make-array '(+rows+ +columns+)
:initial-element nil))

debugger invoked on a TYPE-ERROR in thread #<THREAD "initial thread"
{9004381}>:  The value +ROWS+ is not of type NUMBER.

Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

(*)
0] 0

* (type-of +rows+)

(INTEGER 0 536870911)
*

This seems strange, since these two forms work:
(defparameter *my-array* (make-array '(3 5) :initial-element nil))

*MY-ARRAY*
* (defparameter *my-array* (make-array (list 3 5) :initial-element
nil))

*MY-ARRAY*
*

What nuance am I missing?

Thanks,

Sean

From: Bulent Murtezaoglu
Subject: Re: make-array can't take constants?
Date: 
Message-ID: <877jc9rc4p.fsf@p4.internal>
>>>>> "sw" == seanwinship  <···········@yahoo.com> writes:
[...]
    sw> What nuance am I missing?

When you quote as in '(foo bar) you are passing in a list of symbols.  
Perhaps more examples will help?

CL-USER> (defun test (dimlist) (print dimlist) (print (first dimlist)) 
                (print (second dimlist)))
TEST
CL-USER> (defvar a 1)
A
CL-USER> (defvar b 2)
B
CL-USER> (test '(a b))
(A B) 
A 
B 
B
CL-USER> (test (list a b))
(1 2) 
1 
2 
2
CL-USER> (test (quote (a b)))
(A B) 
A 
B 
CL-USER> (test `(,a ,b))
(1 2) 
1 
2 
2

cheers,

BM
From: ···········@yahoo.com
Subject: Re: make-array can't take constants?
Date: 
Message-ID: <1129727063.676124.74770@g47g2000cwa.googlegroups.com>
Thanks for the quick reply.  I'll spend some quality time with the
Hyperspec to make sure it sticks.

Thanks,

Sean