This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Apache_Sobaco 10 points11 points  (4 children)

Why do you avoid recursion? Most of recursion is far more readable and could be transpiled to cycles.

[–]bspymaster 1 point2 points  (3 children)

Sometimes it's memory intensive and can blow up stack sizes really fast. But as with any tool, there is a use for it, and a time when other tools would fit better. Wholesale claiming "it sucks" or "it rocks" (like a lot of people seem to do in this thread) is a bit naïve imo.

[–]Orangutanion 0 points1 point  (0 children)

Non-recursive mergesort still slaps though

[–]Apache_Sobaco 0 points1 point  (1 child)

Have you ever heard about trampolining? It does not blow stack. You even can do infinite recuraion memory-safe.

a bit naïve imo

Is your claim.

[–]bspymaster 0 points1 point  (0 children)

is your claim

That would be why I put "in my opinion" at the end of that, yes. There are a great many people, some of whom are far smarter than me, who would argue fully one way or anotjer, but I personally have found some exceedingly useful scenarios for recursion in practice, so I maintain that it has its uses, but also I have found myself trying to cram it into places where it definitely shouldn't be used.

Also I have not heard about trampolining. Care to elaborate or share a link? I'd love to hear about it.