From: ············@gmail.com
Subject: export find-symbol
Date: 
Message-ID: <1104889194.212288.66120@f14g2000cwb.googlegroups.com>
Two macros:

(defmacro my-export1 (x)
`(progn
(defstruct ,x)
(export ',(intern (format nil "MAKE-~A" x)))))

(defmacro my-export2 (x)
`(progn
(defstruct ,x)
(export ',(find-symbol (format nil "MAKE-~A" x)))))

both macroexpand (macroexpand '(my-export? A)) to:

(PROGN (DEFSTRUCT A) (EXPORT (QUOTE MAKE-A)))

(my-export1 A)

exports MAKE-A,

(my-export2 A)
does not (in LispWorkds, CMUCL, CLISP). What am I missing?

David

From: ············@gmail.com
Subject: Re: export find-symbol
Date: 
Message-ID: <1104889381.926280.216540@z14g2000cwz.googlegroups.com>
Ignore it -- my stupidness.
From: Larry Clapp
Subject: Re: export find-symbol
Date: 
Message-ID: <slrnctvp82.1tp.larry@theclapp.ddts.net>
In article <·······················@f14g2000cwb.googlegroups.com>,
············@gmail.com wrote:
> Two macros:
> 
> (defmacro my-export1 (x)
>   `(progn
>      (defstruct ,x)
>      (export ',(intern (format nil "MAKE-~A" x)))))
> 
> (defmacro my-export2 (x)
>   `(progn
>      (defstruct ,x)
>      (export ',(find-symbol (format nil "MAKE-~A" x)))))
> 
> both macroexpand (macroexpand '(my-export? A)) to:
> 
> (PROGN (DEFSTRUCT A) (EXPORT (QUOTE MAKE-A)))
> 
> (my-export1 A)
> 
> exports MAKE-A,
> 
> (my-export2 A)
> does not (in LispWorkds, CMUCL, CLISP). What am I missing?

Think about the difference between macro-expansion time and runtime.
Perhaps this will help:

    [ start a new lisp, or define & enter a new package ]
    CL-USER> (defmacro my-export3 (x)
	       `(progn
		  (defstruct ,x)
		  (print ',(find-symbol (format nil "MAKE-~A" x)))))
    MY-EXPORT3

    CL-USER> (macroexpand-1 '(my-export3 a))
    (PROGN (DEFSTRUCT A) (PRINT 'NIL))
    T

    CL-USER> (my-export3 a)
    NIL 
    NIL

    CL-USER> (macroexpand-1 '(my-export3 a))
    (PROGN (DEFSTRUCT A) (PRINT 'MAKE-A))
    T

The FIND-SYMBOL runs *before* the DEFSTRUCT.

-- Larry