Answer the question
In order to leave comments, you need to log in
How to start writing in a functional style?
Reading https://github.com/MostlyAdequate FP code looks readable, shorter. But it seems that for such an approach, you need to throw all the experience and brain out of your head, because when you sit down to solve work tasks, you still tend to the usual imperative, and trying to do it in a functional style requires additional effort and time. Am I dumb or is there some other way to switch to FP?
Answer the question
In order to leave comments, you need to log in
The most hardcore option is to practice in a language that cannot be written in any other way than in a functional style. Haskell, Lisp, Clojure (the same Lisp), Scheme, etc.
More fluid - look at your code and try to rework it a little bit in a functional style, as far as the language allows.
Instead of loops - functions map/reduce/fold/etc ..
As always, applying a new tool (or in this case approach) takes effort until you get used to it. The main thing is to push yourself a little first
Re-read tutorials for different languages)
https://habrahabr.ru/post/154105/
Personally, I managed to write functionally when I got comfortable with such concepts as lazy functions, when I understood well how it works, maybe that you can make a clean one out of any function. well, when there are specific things, when you see why Task can be more interesting than Promise, when you can easily write the simplest Task and map to it. There is a video on YouTube where Frisbee writes in React.
In short, at some point, a revolution will happen when you just start using it a little. Well, everything will start with curry and compos.
I warn you, there will be no going back!
look at this
https://ocw.mit.edu/courses/electrical-engineering...
there is also a book for the course in Russian, you can find it on the net without any problems.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question