If you write isdefined(:x) you're asking if the symbol `x` has anything bound to it. If you write isdefined(x) you're asking if the value of x has anything bound to it. That question only makes sense if the value of x is a symbol. Not sure if that clarifies anything.
On Thu, May 22, 2014 at 4:08 PM, Cirrus McInnis <[email protected]> wrote: > A-ha. Thanks. > Seems odd to me, but I haven't picked up Julia's tune yet. > > > On Thursday, May 22, 2014 4:00:30 PM UTC-4, Stefan Karpinski wrote: > >> I suspect you're calling isdefined(x) when what you want is >> isdefined(:x). This is a normal function and by the time it runs, the >> argument expression has already been evaluated and will cause an error if x >> is undefined. isdefined(x) should only work if x happens to be bound to a >> symbol, in which case it will tell you if that symbol is defined, not if x >> is defined. >> >> >> On Thu, May 22, 2014 at 3:19 PM, Cirrus McInnis <[email protected]>wrote: >> >>> New to Julia.. >>> >>> I'm just trying to test for a var's existence. isdefined() seems to >>> be the tool to use. >>> If the result is true then "true" is returned. >>> If false, "x not defined.." is returned. Shouldn't it return "false"? >>> >>> Is there another way to test for existence? >>> >>> -David >>> >> >>
