(no title)
pineapple_sauce | 1 year ago
Sometimes recursion does allow you to reason about code more easily or come to a working solution faster, sometimes it does not.
Measure the concrete: CPU time and memory consumed. Iteration will likely trump recursive methods w.r.t both these metrics. If it doesn't, you can likely transform your iterative algorithm to one that utilizes SIMD (not always).
mbivert|1 year ago
Let me try: in classical dance, martial arts, or even skateboarding, advanced skills manifest as effortlessness: the movements comes naturally, they're not forced, things just flow.
If you compare a typical functional (recursive + pattern matching, but the point would stand even with a fold) factorial with an imperative one (for loop), the functional approach is more effortless, you have to be less explicit about what's going on. It's more eloquent.
However as you seem to imply, when we're programming, the focus should be on delivering something that works as expected; this particular kind of aesthetic is secondary at best.
paulddraper|1 year ago
Using the beholder's eye, of course.
o11c|1 year ago
burnished|1 year ago
vsuperpower2020|1 year ago
paulddraper|1 year ago
Simplicity is actually a hallmark of this sense of beauty.
burnished|1 year ago
What culty group even exists around recursion anyway? Can you get me an invitation?