Re: def partially done when used in if

2017-06-29 Thread Kaiming Yang
e a proper mutable container like > and atom, ref, or agent, this is what they are for, and they eliminate a > number of gotchas that come with runtime redefinition. > > On Thu, Jun 29, 2017 at 1:07 PM Kaiming Yang > wrote: > >> Hi, >> Recently encountered a weird

def partially done when used in if

2017-06-29 Thread Kaiming Yang
Hi, Recently encountered a weird issue, A def in if clause declared a var but left it unbound. I encountered this issue when I was trying to implement something like "define a symbol if it is not defined yet". Naively I tried: (if (nil? (resolve 'foo)) (def foo 42)) ; Cannot use (def foo (