Hi Everyone,
I am learning Elixir and i am trying to compile this program but not with success.
Goal: TO sum the list parallely using Flow
defmodule ParallelProcessing do
use Flow
def process_numbers(numbers) do
numbers
|> Flow.reduce(fn → 0 end, &(&1+&2))
|>Enum.to_list()
end
end
numbers = 1…10
result= ParallelProcessing.process_numbers(numbers)
IO.inspect(result)
But the following error is thrown
08:57:35.842 [error] GenServer #PID<0.183.0> terminating
** (Protocol.UndefinedError) protocol Enumerable not implemented for 110 of type Integer, Flow attempted to convert the stage accumulator into events but failed, to explicit convert your current state into events use on_trigger/2
I am using Flow version 1.2.4
Elixir version: 1.13.4, Erlang/OTP 25[erts-13.0.4]
All this is being run from Debian and hence these versions (without using asdf)
Can you guys help please
Sincerely,
Suds