This is the mail archive of the 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))
  (define (a) #t)

      I am Lalo of deB-org. You will be freed.
                 Resistance is futile.
                 pgp key in the web page

Debian GNU/Linux       --