curriculum icon indicating copy to clipboard operation
curriculum copied to clipboard

Reduce content suggestions

Open BrooklinJazz opened this issue 1 year ago • 0 comments

Add the steps for breaking down a reduce problem.

  1. Input/Output
  2. Identify the type of problem (map/filter/reduce)
  3. Define the initial accumulator.
  4. Define the steps of the enumeration.
  5. Define the desired accumulator. (for each step)
  6. (optional) Solve one step of the enumeration (at a time)
  7. 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.

BrooklinJazz avatar Jun 16 '23 17:06 BrooklinJazz