Learn Functional Programming
This is a collection of exercises to accompany a half-day workshop on the basics of functional programming.
NOTE: This is not a way to learn hardcore, mathematically correct “functional programming”. This is a collection of exercises to help teach common functional programming techniques that will make your code easier to debug and maintain, regardless of whether or not you have any idea what the fuck a monad is.
# Clone the exercises git clone https://github.com/jlengstorf/learn-fp-exercises.git # Move into the exercise directory cd learn-fp-exercises/ # Open the first exercise open exercises/01-map-array.html
src/01-map-array.js), read the instructions, and refactor away!
If you get stuck, the refactored code is available in
src/solutions/. This isn’t a test, so don’t feel guilty if you need to see a solution to finish a given exercise. However, please actually write the code for each solution by hand — typing things out helps them stick.
Using Chrome Developer Tools
If you'd like to use Chrome’s Developer Tools to do the exercises, follow these steps:
Open the Developer Tools:
Ior, in the menu, View > Developer > Devleoper Tools
Click the "Sources" tab.
clickin the file panel at the left and choose "Add folder to workspace"
DevTools will request full access to the folder. Click "Allow"
01-map-array.htmland choose "Map to File System Resource..."
01-map-array.htmlfrom the dropdown.
Now you can modify and save changes right from DevTools — no editor required!