News for hackers. Stuff that matters.
Re:Mindset Shifts for Functional Programming by roenxi on Thursday April 06, 2023 @05:02AM (#35465979)
I see, so the point you wanted to draw was that if you wanted to implement two functions, mutual recursion might let you separate the implementation logic. That is a nice trick.

> you've changed the semantics and engineering tradeoffs so much that we might as well write `n % 2 == 0`.

That is a fairly glaring weakness of the example you've chosen - it is taking a simple situation and overthinking it. It doesn't really matter because I see your point and surely one would exist, but do you have an example where this technique is an efficient solution?

Re:Mindset Shifts for Functional Programming by chriswarbo on Thursday April 06, 2023 @05:50AM (#35466290)
Yes, exactly :) Again, it's not always "better", but it's a situation that doesn't seem to map directly to a loop.

I gave a more complicated, realistic example in a sibling comment https://news.ycombinator.com/item?id=35466256