There's certainly better, but at least, you can try this : (def void)
(.isBound (var void)) ; or (.hasRoot (var void)) depending on what you want -- Laurent 2009/2/13 Conrad <drc...@gmail.com> > > Hi, is there a standard way to tell if a variable is bound? I couldn't > find a way. > Basically I want something like this, but without the horrible hacks: > > (defn bound? [var] > (try (eval var) > true > (catch java.lang.Exception x false))) > > > (bound? 'foo) > false > > (def foo 33) > 33 > > (bound? 'foo) > true > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---