3 ms·
I'm not much of a functional programmer either, but generally in the beginning you'll feel this way because you're not used to thinking about problems in a func
by sfn42 2y ago
I'm not much of a functional programmer either, but generally in the beginning you'll feel this way because you're not used to thinking about problems in a functional way. You're used to solving problems with imperative structures. So you try to implement that in a functional language and it turns out completely stupid because the language isn't made to solve problems that way. But it usually has good ways to solve things.
- galangalalgol 2y agoI got stuck trying to have an intuition about what would explode my memory usage due to lazy eval, I never got a grip on the transition from pseudofunctional at the io boundaries into real functional internally either.
- anonzzzies 2y agoI like fp and array programming and logic programming (and the overlap) to solve problems that are (considered or for real; I don't usually know going in) really a bad fit for those and then implement them shorter and faster than in their imperative implementation. For some things it does not work obviously, but it's a really nice exercise for when in the gym, walking, cooking, driving and such; the performant or LoC optimising parts fit in my head so I can do the rewrites there and find ways to make them fit. For instance; going from an imperative piece of code to array programming (k/j), you have to find a way to translate the problem to a vector/matrix manipulation problem and that you can do while doing something else entirely. When you find a good one fit, it can be many, many times faster than the original just like that.