1. Real Prizes in Video Games!
1Confidential – Do not distribute
2. 2
PROBLEM
add analytics, but avoid app failures
SOLUTION
get values when present, else, return nil
REFACTOR
better code with pattern matching (and Hex!)
SAVVY PATTERN MATCHING
Confidential – Do not distribute
Map.get fails if developer is not loaded, can’t get to game.
Input - struct or map, list of keys
Work - for each key in our list, extract the value; repeat
Output - the value (result) or nil
Input - struct or map, list of keys
Work - for each key in our list, extract the value; repeat
Output - the value (result) or nil
Loop over list of keys
Starting Accumulator is the object or map passed in as 1st arg to `get`
Invoke `extract_value` for each key.
The result returned by the function (val) is used as the accumulator for the next iteration.
Pass the key and new accumulator to extract_value.
Inputs - value and key
Work - Map.get
Output - nil or result
Create a new mix project
Project is ready to become an Elixir drop! (i.e. package)
deps() is empty
Dependencies can be optional
Include ex_doc for testing in dev mode
A list of files and directories to include in the package. Defaults to standard project directories, so you usually don't need to set this property.
Add documentation!
Add documentation!
register, build, publish
Have 1 hour to make changes without updating your release version.