We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
fn
1 parent f7e1380 commit 538da73Copy full SHA for 538da73
lib/elixir/lib/enum.ex
@@ -2873,10 +2873,10 @@ defmodule Enum do
2873
2874
## Examples
2875
2876
- iex> Enum.scan(["a", "b", "c", "d", "e"], &(&1 <> String.first(&2)))
+ iex> Enum.scan(["a", "b", "c", "d", "e"], fn element, acc -> element <> String.first(acc) end)
2877
["a", "ba", "cb", "dc", "ed"]
2878
2879
- iex> Enum.scan(1..5, &(&1 + &2))
+ iex> Enum.scan(1..5, fn element, acc -> element + acc end)
2880
[1, 3, 6, 10, 15]
2881
2882
"""
@@ -2904,10 +2904,10 @@ defmodule Enum do
2904
2905
2906
2907
- iex> Enum.scan(["a", "b", "c", "d", "e"], "_", &(&1 <> String.first(&2)))
+ iex> Enum.scan(["a", "b", "c", "d", "e"], "_", fn element, acc -> element <> String.first(acc) end)
2908
["a_", "ba", "cb", "dc", "ed"]
2909
2910
- iex> Enum.scan(1..5, 0, &(&1 + &2))
+ iex> Enum.scan(1..5, 0, fn element, acc -> element + acc end)
2911
2912
2913
0 commit comments