3 ms·
I tried learning Scheme. I found that the syntax was easy, basic recursion was easy, solving simple math problems was easy, and even dealing with cons and cdr w
by flounder 15y ago
I tried learning Scheme. I found that the syntax was easy, basic recursion was easy, solving simple math problems was easy, and even dealing with cons and cdr was pretty easy. What's difficult is learning functional programming.
Anyone can pick up Scheme syntax really fast. Where it gets difficult is when people start telling you to not use state, not change values of variables, and to stop using side-effects.
Most people have never done functional programming. How does one make the leap from imperative programming to functional programming?
- unoti 15y agoHere's how I did it for Scala. I went to project Euler, and did the first problem. Then I looked at other people's answers in the same language. I discovered they were doing these tiny little 1 line solutions using functional programming techniques, where I did much larger solutions. I started studying every aspect of how these solutions worked. Along the way I learned about fold, filter, map, and so on. Then I re-implemented my solution using functional idioms. Then I moved on the the next project Euler problem. It didn't take long until I had a pretty firm grasp of it. I did this in Scala; perhaps the same approach would work for you in your language of choice.
- xyzzyz 15y agoYou don't need to make this leap if you haven't learned imperative programming before functional.