[Openmcl-devel] macro, symbol value and declare special

Pascal J. Bourguignon pjb at informatimago.com
Thu Dec 9 04:54:46 UTC 2010


Pascal Costanza <pc at p-cos.net> writes:

> On 8 Dec 2010, at 23:47, Taoufik Dachraoui wrote:
>
>> Hi
>> 
>> I run the following test
>> 
>> ? (defmacro m1 (a) `,(let ((i a)) (declare (special i)) (symbol-value 'i)))
>> M1
>> ? (m1 3)
>> 3
>> ? (let ((k 45)) (m1 k))
>> 45
>> ? (defmacro m1 (a) `,(let ((i a)) (declare (special i)) (1+ (symbol-value 'i))))
>> M1
>> ? (m1 3)
>> 4
>> ? (let ((k 45)) (m1 k))
>> return  "value K is not of the expected type NUMBER."
>> 
>> Could someone please explain to me this?
>

> Did you already walk through Common Lisp tutorials in more detail,
> like Peter Seibel's Practical Common Lisp, Peter Norvig's Paradigms of
> Artificial Intelligence Programming, or Paul Graham's On Lisp? If not,
> it's strongly recommended to do that first, because it seems you're
> lacking some fundamental knowledge about the use of macros.

Or:
          Casting Spels in Lisp
          Conrad Barski, M.D.
          http://www.lisperati.com/casting.html

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.




More information about the Openmcl-devel mailing list