3 ms·
Curious. It implies tail call elimination (the description of exhausting the stack explicitly says it wasn't a tail recursive call), but the description sounds
by andrewcooke 17y ago
Curious. It implies tail call elimination (the description of exhausting the stack explicitly says it wasn't a tail recursive call), but the description sounds like it's so direct that I can't see how it works.
Looking at evalExpr - http://github.com/bobappleyard/golisp/blob/master/lisp/lisp.go#L417 http://github.com/bobappleyard/golisp/blob/master/lisp/lisp.... - the only way I can see for this to have tail call elimination is if Go itself does (and I don't think it does, does it? It does have coroutines, which you could use to implement trampolining, but I don't see that here...)
- maxtilford 17y agoI think tail call elimination is handled in the Apply method for closures - http://github.com/bobappleyard/golisp/blob/master/lisp/lisp.go#L567 http://github.com/bobappleyard/golisp/blob/master/lisp/lisp.... . Looks like a trampoline to me.
- andrewcooke 17y agoAhhh. Thanks. After thinking about that I realised I don't understand Go's syntax :o)