Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions getting_started/10.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ They are lazy because, as shown in the example above, `1..100_000 |> Stream.map(

```iex
iex> 1..100_000 |> Stream.map(&(&1 * 3))
#Stream<1..100_000, funs: [#Function<34.16982430/1 in Stream.map/2>]>
#Stream<[enum: 1..100000, funs: [#Function<34.16982430/1 in Stream.map/2>]]>
```

Furthermore, they are composable because we can pipe many stream operations:

```iex
iex> 1..100_000 |> Stream.map(&(&1 * 3)) |> Stream.filter(odd?)
#Stream<1..100_000, funs: [...]>
#Stream<[enum: 1..100000, funs: [...]]>
```

Many functions in the `Stream` module accept any enumerable as argument and return a stream as result. It also provides functions for creating streams, possibly infinite. For example, `Stream.cycle/1` can be used to create a stream that cycles a given enumerable infinitely. Be careful to not call a function like `Enum.map/2` on such streams, as they would cycle forever:
Expand Down