curriculum
curriculum copied to clipboard
Reduce content suggestions
Add the steps for breaking down a reduce problem.
- Input/Output
- Identify the type of problem (map/filter/reduce)
- Define the initial accumulator.
- Define the steps of the enumeration.
- Define the desired accumulator. (for each step)
- (optional) Solve one step of the enumeration (at a time)
- Put the pieces above into a reduce statement
Here's an example:
# char count (reduce)
# "aba" -> ["a", "b", "a"] -> %{"a" => 2, "b" => 1}
# %{}
# "a" # %{"a" => 1}
# "b" # %{"a" => 1, "b" => 1}
# "a" # %{"a" => 2, "b" => 1}
Also, add the :reduce option to the reading material. I didn't know about it and it doesn't seem much discussed in the community.
Add a section to comprehensions that talks about how to convert an Enum expression to a comprehension.