Comment by kubb 6 hours ago You can just compile any tail recursive function to a function with a loop and no recursion. 5 comments kubb Reply 1-more 6 hours ago This is in fact how Elm does it! Tail call recursion compiles to a while loop. srean 5 hours ago That does not address the use case where I find tail recursion most tempting. That would be mutually recursive functions.If the function can be written as an idiomatic loop I probably would do so in the first place. apgwoz 22 minutes ago You _can_ do trampolines, but that is kind of infectious, or needs to be very explicit with extra code, etc. adamwk 6 hours ago [dead]
srean 5 hours ago That does not address the use case where I find tail recursion most tempting. That would be mutually recursive functions.If the function can be written as an idiomatic loop I probably would do so in the first place. apgwoz 22 minutes ago You _can_ do trampolines, but that is kind of infectious, or needs to be very explicit with extra code, etc.
apgwoz 22 minutes ago You _can_ do trampolines, but that is kind of infectious, or needs to be very explicit with extra code, etc.
This is in fact how Elm does it! Tail call recursion compiles to a while loop.
That does not address the use case where I find tail recursion most tempting. That would be mutually recursive functions.
If the function can be written as an idiomatic loop I probably would do so in the first place.
You _can_ do trampolines, but that is kind of infectious, or needs to be very explicit with extra code, etc.
[dead]