From: kokoml
Subject: Dynamic creation of generic functions without eval?
Date: 
Message-ID: <07dc43b6.42d319dc@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?

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!

From: Lieven Marchand
Subject: Re: Dynamic creation of generic functions without eval?
Date: 
Message-ID: <8dl55d$ebv$1@newnews1.news.nl.uu.net>
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
From: Joachim Pimiskern
Subject: Re: Dynamic creation of generic functions without eval?
Date: 
Message-ID: <8dka7c$1l7$1@proxy2.fe.internet.bosch.de>
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!
From: Eugene Zaikonnikov
Subject: Re: Dynamic creation of generic functions without eval?
Date: 
Message-ID: <956148474.388966@cpl2500.cit.org.by>
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.
From: Paul Rudin
Subject: Re: Dynamic creation of generic functions without eval?
Date: 
Message-ID: <m3k8hshawd.fsf@shodan.demon.co.uk>
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?