Re:Why study functional programming? (2012)
by kephasp on Sunday August 14, 2022 @11:49AM
(#32460235)
I read about them a few times, but I never saw them proposed as the main access to recursion. Are there examples of that use?
Re:Why study functional programming? (2012)
by grumpyprole on Thursday August 18, 2022 @05:59AM
(#32507385)
If you don't mind some advanced Haskell, these slides have plenty of examples:
https://github.com/willtim/recursion-schemes/blob/master/sli...
Yes recursion is a useful tool, just like GOTO and is sometimes necessary or more practical. But it is better to e.g. use a fold if you can because that further constrains and aids reasoning. For example, a fold will always terminate unlike general recursion.
I recommend looking into recursion schemes, if you aren't familiar with them.