Re:A Tour of Lisps
by chriswarbo on Thursday February 01, 2024 @08:26AM
(#39215672)
Most of the time "recursing through a linked list" is still too low-level; and we can instead write our code at a higher level with `map`, `reduce`, etc. Recursion is then just an implementation detail of those functions; which we could instead swap out for, say, massively parallel fan-out across a datacentre (i.e. frameworks like MapReduce, and its descendents like Spark)!
On "classical" computing hardware, it's fine. On present-day architectures we're better off writing with "wider" operations across vectors rather than depth-first-ish recursive operations on scalars.
But yes, for some domains, the performance doesn't matter.
I just also find recursion more difficult to read in some contexts. In others, things like tree transformation etc. it's easier to read, for sure.
But I am also a fan of immutable, or at least copy-on-write, data, expressed in series of functional applications, etc. etc.