99 Elm Problems/Learning Track

Problem presentation

edit

Each step of the Learning Track will have links to problems in order from simple to complex. This will often not be in numerical order. A link is provided to each problem page which has:

  1. The problem statement: Describes problem, and ask you to implement a solution.
  2. An example: Presents a example of the function with input and the correct result.
  3. A unit test: A complete program that executes multiple tests of problem solution. You can use this program on the Elm online editor, http://elm-lang.org/try. The stubbed-out function you need to implement will be at the top, just below the imports.
  4. Hints: Suggests one or more ways to implement a solution.
  5. Solutions: Links to a page with one or more solutions.

Learning from the problems

edit

Copy the unit test into the Elm online editor, http:/elm-lang.org/try, or in the debugger-enabled http://debug.elm-lang.org/try. Find the stubbed-out functions with comment -- your implementation goes here. Attempt to implement the function. You may want or to write helper functions to complete your solutions.

Click “Compile” to test your code. If your solution is correct you will be rewarded with the message “Your implementation passed all tests”. If tests fail, examine which tests failed and try again.

We learn best by doing, so before checking the hints or the solutions page, attempt to solve the problem yourself. Apply what you learned from the previous problems to solve the later problems. Then check the hints and see if that doesn’t inspire other solutions or improvements to your own. Finally, check the solutions page to learn from those examples.

  1. Step 1: Simple list functions
  2. Step 2: Passing functions as arguments
  3. Maybe Just Nothing
  4. Recursion
  5. Recursion on Lists
  6. Recursion on Binary Trees
  7. Map
  8. Fold