News for hackers. Stuff that matters.
Re:Ask HN: Concepts that clicked only years after you first ... by sirsinsalot on Sunday January 01, 2023 @03:10PM (#34210331)
Yes but if you represent 2 functions over some state a(s) and b(s) then you have the same issue with this as if it was:

Class s: fun a(self)... fun b(self)...

The problem is mutability not how state is bound to a function.

Re:Ask HN: Concepts that clicked only years after you first ... by JanisErdmanis on Sunday January 01, 2023 @03:48PM (#34210697)
The idea is to make the functions pure and return the state ‘a(s_1) -> s_2, value’. Makes so much easier to test and write concurrent programs.

Though it’s not always practical, like when needing to push an element to an array for making updated state. It is nevertheless possible to shave of pure parts considerably making mutability easier to maintain.