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

Pascal Costanza pc at p-cos.net
Wed Dec 8 22:56:10 UTC 2010


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.


Pascal

-- 
Pascal Costanza, mailto:pc at p-cos.net, http://p-cos.net
Vrije Universiteit Brussel
Software Languages Lab
Pleinlaan 2, B-1050 Brussel, Belgium









More information about the Openmcl-devel mailing list