News for hackers. Stuff that matters.
Re:Why Functional Programming Should Be the Future of Software by monkpit on Wednesday November 02, 2022 @04:09PM (#33442263)
If you were to write a post about taking an example imperative program and showing the conversion to FP, I’d be very interested to read it. Or if you have a link handy to someone else’s post?

For me it’s difficult to immediately understand what you mean about the top level program, mapM, etc. I guess what you mean is that they entire program can be expressed as 1 call with some args? I feel like there is probably more nuance that I am not grasping.

I am curious to add this way of thinking to my toolbox, and I learn best by examples.

I have read things like Mostly adequate guide to FP and whatnot. They always get stuck on side effects and containers, which is fine, but doesn’t really address the larger scope of program design.

Re:Why Functional Programming Should Be the Future of Software by justcoder on Thursday November 03, 2022 @03:54AM (#33448199)
In the second part of the "Solving Problems the Clojure Way"[0] talk, the speaker shows step-by-step transformation of the heavy imperative (book-keepish) JavaScript code to a more functional approach.

As a result of transformation, ~95% of the code is easily unit-testable and the only impure code is the call to main which basically starts all the domino falling.

[0] https://www.youtube.com/watch?v=vK1DazRK_a0