That's the usual late-binding semantics for global functions in Lisp.<p>Note that in Common Lisp a compiler can assume that the recursive call is actually the same function:<p>> Within a function named F, the compiler may (but is not required to) assume that an apparent recursive call to a function named F refers to the same definition of F, unless that function has been declared notinline. The consequences of redefining such a recursively defined function F while it is executing are undefined.
I've always thought that in languages where functions are first-class, a function referring to itself via a name binding is strange, since the function is supposed to be a value just like any other. Values like 33 or the list of foo,"bar",7.5 aren't aware of which names (if any) are bound to themselves and that's how it should be.<p>The so-called recur* in the post sounds like an improvement.
TL;DR:<p>(defn foo baz)<p>does not mean the same thing as<p>(defn (foo n) (baz n)) == (defn foo (lambda (n) (baz n)))<p>because in the former case baz is dereferenced when foo is defined and in the latter case it's dereferenced when foo is called. So in the former case, if baz changes between when foo is defined and when it is called, you'll get surprising results.
cdown is not "no longer recursive"!<p>It is either "still recursive" or "never had been recursive" depending on your point of view.<p>Evidence for "still recursive": when you call it, the countdown is consed up.<p>Evidence for "never had been recursive": nowhere in the code was there ever a call to cdown, other than the top-level one.<p>> <i>(def cdown #'countdown) ... This works but is rather counterintuitive; with a Lisp-1 you get used to refering to functions directly rather than with a quoted symbol, but here we have to use both a quote and a #.</i><p>It is counterintuitive not because of Lisp-1 versus Lisp-2 but because in (def cdown countdown) the symbolic reference to the function countdown is immediately evaluated to an object that is bound to cdown, such that cdown doesn't follow a redefinition of countdown. Yet, in (def cdown #'countdown), the #'countdown is deferred so that the countdown symbol is re-evaluated. This means that def has strange evaluation rules, or that #'countdown has nothing to do with the Common Lisp #'countdown: namely, it produces some kind of proxy object which resolves to a function, using late binding with a symbol that is captured in its innards. Or possibly #'countdown produces a wrapper function which takes the call and defers to countdown, by symbol. That's what is "counterintuitive": that countdown and #'countdown do not evaluate to the same thing based on experiences with some other dialect.
This is a good example of why it is better to be lexically scoped (at least by default, with a possible way to escape that). But I would have thought that clo<i>j</i>ure would be. Is it really not?