Find quick preparation steps
Before you start this advanced track
Functions and collections. Work with immutable data, tuples, atoms, and pattern matching.
Guided code reading and debugging. Runnable coding challenges are available in JavaScript, Python, and SQL.
Understand it, then try it.
Enum.filter walks through a collection and keeps each value for which a function returns true. The fn ... end form defines that function inline. A recipe planner uses it to keep preparation steps shorter than ten minutes. Enum.join then formats the remaining durations in the same order.
minutes = [4, 12, 7, 18]quick = Enum.filter(minutes, fn minute -> minute < 10 end)report = Enum.join(quick, ", ")IO.puts(report)Each mission is a standalone Elixir script run with elixir. Only standard-library modules are used. Answers describe printed output, excluding any extra value an interactive IEx session would echo.
Track the values line by line. Predict the result before running this example in your own editor.