[gambit-list] Determine if symbol is bound

Adrien Piérard pierarda at iro.umontreal.ca
Mon May 9 05:51:00 EDT 2011


What about this?

(define-macro (bound? x)
  `(with-exception-handler
     (lambda (e) #f)
     (lambda () (and ,x #t))))

(pp (bound? x))
(let ((y 3))
  (pp (bound? y)))


Cheers,

P!

2011/5/9 William James <w_a_x_man at yahoo.com>:
> How do you check to see if a symbol is already bound?
> To be used in this fashion:
>
> (if (bound? x)
>  (set! x 22)
>  (define x 22))
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
>



-- 
Français, English, 日本語, 한국어



More information about the Gambit-list mailing list