by
clemens
(27.09.2021)
For With Reduce in Elixir
tl;dr
You can perform a reduce using for by using the reduce: [] opt.
for i <- [1, 2, 3], reduce: [] do
acc -> [i | acc]
end
[3, 2, 1]
tl;dr
You can perform a reduce using for by using the reduce: [] opt.
for i <- [1, 2, 3], reduce: [] do
acc -> [i | acc]
end
[3, 2, 1]