Hello people, it is my first post on the forum, and i would like some help to understand something that seems wrong with the function Enum.foldr, as it returned the same result of Enum.foldl, which i wasn’t expecting.
I was following one of the examples of the book “Introducing Elixir - Simon St. Laurent” where it explains how both functions works and even give an example where these functions returns different results. But when i tried the same test on iex, it returned the same result for both. See below:
list = [2, 4, 8, 16, 32]
divide = fn(value, accumulator) -> value / accumulator end
Enum.foldl(list, 1, divide) #Returns 8.0, which is correct
Enum.foldr(list, 1, divide) #Returns 8.0, when, according to the book, should be 0.125