This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Testing availabilty of a procedure


On May 02, Ingo Hohmann decided to present us with:
> 
> I try to test wether a procedure is defined, and define
> it if it isn't:
> 
> (if (procedure? a)
>     #t
>     (define (a) #t))
> 
> but if a isn't defined at all, this doesn't work.
> Any other ideas?

(if (and (defined? a) (procedure? a))
  #t
  (define (a) #t)
)

[]s,
                                               |alo
                                               +----
--
      I am Lalo of deB-org. You will be freed.
                 Resistance is futile.

http://www.webcom.com/lalo      mailto:lalo@webcom.com
                 pgp key in the web page

Debian GNU/Linux       --        http://www.debian.org