From 53263b5706a0521f46824afa9e8646310cbdc3ca Mon Sep 17 00:00:00 2001 From: David Sulc Date: Wed, 14 Aug 2024 08:23:34 +0200 Subject: [PATCH 1/2] fix example comment in Enum.slide/3 --- lib/elixir/lib/enum.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/elixir/lib/enum.ex b/lib/elixir/lib/enum.ex index 0d61149fe95..d1b202bfff1 100644 --- a/lib/elixir/lib/enum.ex +++ b/lib/elixir/lib/enum.ex @@ -2706,11 +2706,11 @@ defmodule Enum do iex> Enum.slide([:a, :b, :c, :d, :e, :f, :g], 5, 1) [:a, :f, :b, :c, :d, :e, :g] - # Slide a range of elements backward + # Slide a range of elements forward iex> Enum.slide([:a, :b, :c, :d, :e, :f, :g], 3..5, 1) [:a, :d, :e, :f, :b, :c, :g] - # Slide a range of elements forward + # Slide a range of elements backward iex> Enum.slide([:a, :b, :c, :d, :e, :f, :g], 1..3, 5) [:a, :e, :f, :b, :c, :d, :g] From 77359ae079b68852981a5f13a5fe825601156b8f Mon Sep 17 00:00:00 2001 From: David Sulc Date: Wed, 14 Aug 2024 09:32:44 +0200 Subject: [PATCH 2/2] reword to reduce ambiguity "forward" could mean - towards the head of the list - farther in the reading direction (i.e., farther to the right) By referring instead to the list's head/tail, the ambiguity is resolved. --- lib/elixir/lib/enum.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/elixir/lib/enum.ex b/lib/elixir/lib/enum.ex index d1b202bfff1..dbe1bd6c129 100644 --- a/lib/elixir/lib/enum.ex +++ b/lib/elixir/lib/enum.ex @@ -2706,11 +2706,11 @@ defmodule Enum do iex> Enum.slide([:a, :b, :c, :d, :e, :f, :g], 5, 1) [:a, :f, :b, :c, :d, :e, :g] - # Slide a range of elements forward + # Slide a range of elements towards the head of the list iex> Enum.slide([:a, :b, :c, :d, :e, :f, :g], 3..5, 1) [:a, :d, :e, :f, :b, :c, :g] - # Slide a range of elements backward + # Slide a range of elements towards the tail of the list iex> Enum.slide([:a, :b, :c, :d, :e, :f, :g], 1..3, 5) [:a, :e, :f, :b, :c, :d, :g]