Elixir·Elixir essentials

Collections

Lists, maps and keyword lists are transformed with Enum and Stream.

Intermediate 10 min read Lesson 4 of 150 Challenge included
What you will be able to do
  • Use Enum.map and Enum.filter.
  • Use Map.get for maps.
  • Streams are lazy.

In plain English

Lists, maps and keyword lists are transformed with Enum and Stream.

  • Use Enum.map and Enum.filter.
  • Use Map.get for maps.
  • Streams are lazy.
collections.exsELIXIR
lessons = [%{title: "HTML", minutes: 12}, %{title: "CSS", minutes: 18}]
long = Enum.filter(lessons, fn l -> l.minutes >= 15 end)
IO.inspect(Enum.map(long, & &1.title))
Your turn

Explain it back

Easy

Answer from memory: Which module provides eager collection functions?

TEXT · starter
Your answer…
Check your understanding before moving on.
Knowledge checkQuestion 1

Which module provides eager collection functions?

Select an answer to continue
Study tools

Make it yours.

Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.

Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign in
Finished reading?

Lock in what you just learned.

Mark this lesson complete to save your place and move one step closer to the certificate.

Next: Small program
Lesson 4 of 150 · 0% of course