From 5598b05ecae505a2e8e6b0a50d95fc372fc1f09f Mon Sep 17 00:00:00 2001 From: dmitrykleymenov Date: Sat, 10 May 2025 15:45:55 +0300 Subject: [PATCH 1/5] Small typo fix --- lib/elixir/lib/application.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/elixir/lib/application.ex b/lib/elixir/lib/application.ex index 670f34ad36b..ddba6c62983 100644 --- a/lib/elixir/lib/application.ex +++ b/lib/elixir/lib/application.ex @@ -247,7 +247,7 @@ defmodule Application do invoked if it hasn't been done yet. Then, it checks if the dependencies listed in the `applications` key of the resource file are already started. Having at least one dependency not started is an error condition. Functions like - `ensure_all_started/1` takes care of starting an application and all of its + `ensure_all_started/1` take care of starting an application and all of its dependencies for you. If the application does not have a callback module configured, starting is From c006c926974cf46a96051cd7d45ab56ad09780b5 Mon Sep 17 00:00:00 2001 From: dmitrykleymenov Date: Sat, 10 May 2025 15:47:51 +0300 Subject: [PATCH 2/5] Improve Enum.scan/2 docs --- lib/elixir/lib/enum.ex | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/elixir/lib/enum.ex b/lib/elixir/lib/enum.ex index 35a267734f1..a11eca91007 100644 --- a/lib/elixir/lib/enum.ex +++ b/lib/elixir/lib/enum.ex @@ -2864,13 +2864,16 @@ defmodule Enum do end @doc """ - Applies the given function to each element in the `enumerable`, - storing the result in a list and passing it as the accumulator - for the next computation. Uses the first element in the `enumerable` - as the starting value. + Passes each element from `enumerable` to the `fun` as the first argument, + stores the `fun` result in a list and passes the result as the second argument + for the next computation. The `fun` isn't applied for the first element + of the `enumerable`, the element is taken as it is. ## Examples + iex> Enum.scan(["a", "b", "c", "d", "e"], &(&1 <> String.first(&2))) + ["a", "ba", "cb", "dc", "ed"] + iex> Enum.scan(1..5, &(&1 + &2)) [1, 3, 6, 10, 15] From 35897468968c8f4b1c479351101f529276d4bef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 10 May 2025 14:58:17 +0200 Subject: [PATCH 3/5] Update lib/elixir/lib/enum.ex --- lib/elixir/lib/enum.ex | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/elixir/lib/enum.ex b/lib/elixir/lib/enum.ex index a11eca91007..90759ec81ad 100644 --- a/lib/elixir/lib/enum.ex +++ b/lib/elixir/lib/enum.ex @@ -2866,8 +2866,10 @@ defmodule Enum do @doc """ Passes each element from `enumerable` to the `fun` as the first argument, stores the `fun` result in a list and passes the result as the second argument - for the next computation. The `fun` isn't applied for the first element - of the `enumerable`, the element is taken as it is. + for the next computation. + + The `fun` isn't applied for the first element of the `enumerable`, + the element is taken as it is. ## Examples From 78fe0236aabfb2a943e00728369961c6f8060240 Mon Sep 17 00:00:00 2001 From: dmitrykleymenov Date: Sat, 10 May 2025 16:03:59 +0300 Subject: [PATCH 4/5] Fixes for Enum.scan/3 --- lib/elixir/lib/enum.ex | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/elixir/lib/enum.ex b/lib/elixir/lib/enum.ex index 90759ec81ad..821e24dfc9a 100644 --- a/lib/elixir/lib/enum.ex +++ b/lib/elixir/lib/enum.ex @@ -2896,11 +2896,15 @@ defmodule Enum do end @doc """ - Applies the given function to each element in the `enumerable`, - storing the result in a list and passing it as the accumulator - for the next computation. Uses the given `acc` as the starting value. + Passes each element from `enumerable` to the `fun` as the first argument, + stores the `fun` result in a list and passes the result as the second argument + for the next computation. + + Passes the given `acc` as the second argument for the `fun` with the first element. ## Examples + iex> Enum.scan(["a", "b", "c", "d", "e"], "_", &(&1 <> String.first(&2))) + ["a_", "ba", "cb", "dc", "ed"] iex> Enum.scan(1..5, 0, &(&1 + &2)) [1, 3, 6, 10, 15] From f7e138064b9b4d9716aa890b1e6aaa9622d1b4c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 10 May 2025 15:18:21 +0200 Subject: [PATCH 5/5] Update lib/elixir/lib/enum.ex --- lib/elixir/lib/enum.ex | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/elixir/lib/enum.ex b/lib/elixir/lib/enum.ex index 821e24dfc9a..d3e2c4339d7 100644 --- a/lib/elixir/lib/enum.ex +++ b/lib/elixir/lib/enum.ex @@ -2903,6 +2903,7 @@ defmodule Enum do Passes the given `acc` as the second argument for the `fun` with the first element. ## Examples + iex> Enum.scan(["a", "b", "c", "d", "e"], "_", &(&1 <> String.first(&2))) ["a_", "ba", "cb", "dc", "ed"]