2.0 KiB
2.0 KiB
Hints
General
- Read about the
Enum
module in the official Getting Started guide or on elixirschool.com. - Take a look in the documentation for the full list of functions in the
Enum
module.
1. Sort items by price
- There is a built-in function for sorting enumerables using a sorter function.
2. Find all items with missing prices
- There is a built-in function for filtering enumerables.
3. Update item names
- There is a built-in function for transforming every element in an enumerable.
- There is a built-in function that can replace all instances of one string with a different one.
4. Increment the item's quantity
- Maps implement the enumerable protocol.
Enum
functions convert maps to a list of{key, value}
tuples.- There are two different functions that can transform a list of
{key, value}
tuples back into a map using a transformation function. One of them always returns a new map, while the other lets you choose a collectible.
5. Calculate the item's total quantity
- Maps implement the enumerable protocol.
Enum
functions convert maps to a list of{key, value}
tuples.- There is a built-in function for reducing an enumerable to a single value.