3 ms·
First, recur is annoying because functions can have multiple arities, but you can only recur to the same arity. So (defn foo ([bar baz] ...) ([bar] .
by lg 17y ago
First, recur is annoying because functions can have multiple arities, but you can only recur to the same arity. So
(defn foo
([bar baz] ...)
([bar] ... (recur x y)))
would fail because you're in foo/1 when you call it which seems broken to me.
Second, not all lisps are as PC as clojure (though most try), CL lets you use 'go (goto) within a tagbody which afaic is the right thing.
- jrockway 17y agoYes, that does seem broken. All the state is in the arguments, so it shouldn't matter what function you "recur" to. I know this is a hack, but in Perl you can "goto" a function to remove the current function from the stack and replace it with the thing you goto. This seems about the same as "recur", but more flexible.