guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to detect a procedure


From: rm
Subject: Re: How to detect a procedure
Date: Mon, 29 Apr 2002 11:45:50 +0200
User-agent: Mutt/1.3.24i

On Mon, Apr 29, 2002 at 06:52:28AM +0200, address@hidden wrote:
> On Sun, 28 Apr 2002, Bruce Korb wrote:
> 
> > 
> > OK.  If:
> > 
> >   (if (procedure? 'mumble) (mumble))
> > 
> > doesn't work, what does?  I keep trying different things
> > to no avail.  This is very, very frustrating.
> 
> First of all, this type of thing is better off posted to guile-user 
> instead of guile-devel (where nitty-gritty implementation details are 
> mainly discussed).
> 
> Secondly, the answer to your query is, procedures are stored in the same 
> namespace as ordinary variables; (procedure? mumble) returns #t if mumble 
> names a prevoiusly defined procedure. There is no need to quote, e.g. 
> 'mumble, or to use the Common LISP convention #'mumble.

Well, there's no need to quote, but if mumble _isn't_ defined than (procedure? 
mumble)
will barf ... 
The most stable approach would be:

 (and (defined 'blub) (procedure? blub))   

 and the conditional execution could be done like this:

 (if (and (defined 'blub) (procedure? blub)) 
     (blub ...)
     (error "You need a newer version of transmogrify!"))

 Ralf Mattes


> Note that this applies to primitives, too; (procedure? procedure?) returns 
> #t. :)
> 
> -- 
> Jeffrey T. Read
> "LOBSTER STICKS TO MAGNET!"
> 
> 
> _______________________________________________
> Guile-devel mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/guile-devel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]