concept Enum in category elixir

This is an excerpt from Manning's book Elixir in Action.
There are many operations you can do with lists, but this section mentions only a couple of the most basic ones. For a detailed reference, see the documentation for the
Listmodule (https://hexdocs.pm/elixir/List.html). There are also many helpful services in theEnummodule (https://hexdocs.pm/elixir/Enum.html).
Enum.each/2is just one example of an iteration powered by a higher-order function. Elixir’s standard library provides many other useful iteration helpers in theEnummodule. TheEnummodule is a Swiss Army knife for loops and iterations; it contains a lot of useful functions. You should spend some time researching the module documentation (https://hexdocs.pm/elixir/Enum.html). Here we’ll look at some of the most frequently usedEnumfunctions.
To make the iteration happen, you have to send the stream to an
Enumfunction, such aseach,map, orfilter. You can also use theEnum.to_list/1function, which converts any kind of enumerable into a list:iex(5)> Enum.to_list(stream) #1 [2, 4, 6] #1 At this point, stream iteration takes place.
Enum.to_list/1(and any otherEnumfunction, for that matter) is an eager operation. It immediately starts iterating through the input and creates the result. In doing so,Enum.to_list/1requests that the input enumerable start producing values. This is why the output of the stream is created when you send it to anEnumfunction.