I have written a function that relies on functions from an external library that may for various reasons fail to load. I would like to test if the functions in the external library have been defined before using them.
This seems like a natural approach:
NameQ["unloadedFxn"] (* returns False, as expected *)
and in isolation it works. Unfortunately, in practice,
unloadedFxn appears within other functions, which causes it to be initialized.
otherFxn[x_] := 1 + unloadedFxn[x]; NameQ["unloadedFxn"] (* returns True, which is not what I want *) (* because the function still hasn't been defined *)
Is there some other test that would let me see whether or not
unloadedFxn has a definition?
[Addendum: I can kludge myself to a solution with
! ToString[Definition[unloadedFxn]] == "Null" but it feels inelegant. If you've got a cleaner solution, I'd love to hear it.]