4 ms·
> functional programming idioms Proper tail recursion was still missing last time I checked. Does it affect functional programming in Rust?
by xjia 10y ago
> functional programming idioms
Proper tail recursion was still missing last time I checked. Does it affect functional programming in Rust?
- iopq 10y agoIt's rare to actually use tail-recursive algorithms in Rust since those can be written with a loop, which Rust does support. I mean, it's rare to actually manually recurse in Haskell too, and when you need to, it's often not something you can write tail-recursively.
- flubert 10y ago>it's rare to actually manually recurse in Haskell I wonder if there is a semi-easy way to measure this. My impression was that while the papers and tutorials are all about combinators, the people writing Haskell "in the wild" tend to go with general recursion more often than you might expect.
- iopq 10y agoEven if you recurse, it doesn't mean you can make it tail-recursive. It might be a style issue, but Rust programmers are just going to use combinators instead anyway since recursion is slower.
- steveklabnik 10y agoIt's not guaranteed, though LLVM may do it if it feels like it. We may gain guaranteed TCO in the future, we'll see.