2 ms·
Is it even recursing in the tail position though? Reading the code it looks to me like the recursion result is used as an argument to a subsequent function call
by EdwardDiego 11y ago
Is it even recursing in the tail position though? Reading the code it looks to me like the recursion result is used as an argument to a subsequent function call (append).
- rachbowyer 11y agoSpot on! The code fails as the author has used nil? rather than empty? The recursive call is not from the tail position so tail call optimisation is not possible in any language.
- PuercoPop 11y ago> tail call optimisation is not possible in any language. Afaik it is possible in racket. Read the note at the end here: http://matt.might.net/articles/lexers-in-racket/ http://matt.might.net/articles/lexers-in-racket/
- PuercoPop 11y agoYou are right, should have said recursion instead.