I would like to define a function which will return a new
generic function as result, something like this:
(defun my-fun (name args)
(eval `(defgeneric ,name ,args)))
Could it be implemented without using eval?
Michal
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
kokoml <·····················@math.slu.cz.invalid> writes:
> I would like to define a function which will return a new
> generic function as result, something like this:
>
> (defun my-fun (name args)
> (eval `(defgeneric ,name ,args)))
>
Look up ENSURE-GENERIC-FUNCTION in the hyperspec.
--
Lieven Marchand <···@bewoner.dma.be>
If there are aliens, they play Go. -- Lasker
Hi Michal,
kokoml schrieb in Nachricht <·················@usw-ex0107-055.remarq.com>...
>I would like to define a function which will return a new
>generic function as result, something like this:
>
>(defun my-fun (name args)
> (eval `(defgeneric ,name ,args)))
>
>Could it be implemented without using eval?
do you mean s.th. like
------------------------------------------------
(defmacro make-function (name args &rest body)
`(defun ,name ,args ,@body)
)
(make-function my-sqr (x) (* x x))
(my-sqr 3)
------------------------------------------------
This three commands yield the following output:
------------------------------------------------
(MACRO (NAME ARGS &REST BODY) (BACKQUOTE
(DEFUN (COMMA NAME) (COMMA ARGS) (COMMA-AT BODY))))
(LAMBDA (X) (* X X))
9
------------------------------------------------
Regards,
Joachim
--
*** Go - das 4000 Jahre alte asiatische Brettspiel ***
Einrichtung der deutschsprachigen Newsgroup de.rec.spiele.go
-->> http://www.dana.de/mod/cfv/1.CfV-de.rec.spiele.go.txt
[ JA ] de.rec.spiele.go Jetzt abstimmen!
kokoml <·····················@math.slu.cz.invalid> wrote in message
······················@usw-ex0107-055.remarq.com...
> I would like to define a function which will return a new
> generic function as result, something like this:
>
> (defun my-fun (name args)
> (eval `(defgeneric ,name ,args)))
>
> Could it be implemented without using eval?
>
If you want my-fun to be a wrapper for your own domain-specific definitions,
consider using macro instead:
(defmacro my-fun (name args)
`(defgeneric ,name ,args))
--
Eugene.
kokoml <·····················@math.slu.cz.invalid> writes:
> I would like to define a function which will return a new
> generic function as result, something like this:
>
> (defun my-fun (name args)
> (eval `(defgeneric ,name ,args)))
>
> Could it be implemented without using eval?
>
Presumably CL:ENSURE-GENERIC-FUNCTION will do?