我是新的酏剂,我目前正在重写一个算法从C到酏剂。
我想以并行的方式调用一个递归。最后所有的结果应该加在一起。
我在文档中检查了Task,因为有一些类似于C中存在的东西。但不幸的是,我不能再进一步了。
使用我的代码,我得到以下异常
13:22:31.158 [error] GenServer #PID<0.964.0> terminating
** (Protocol.UndefinedError) protocol Enumerable not implemented for {:cont, {:cont, %{}}} of type Tuple, Flow attempted to convert the stage accumulator into events but failed, to explicit convert your current state into events use on_trigger/2. This protocol is implemented for the following type(s): Flow, Date.Range, File.Stream, Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, List, Map, MapSet, Range, Stream
(elixir 1.10.3) lib/enum.ex:1: Enumerable.impl_for!/1
(elixir 1.10.3) lib/enum.ex:141: Enumerable.reduce/3
(elixir 1.10.3) lib/enum.ex:3383: Enum.reverse/1
(elixir 1.10.3) lib/enum.ex:2984: Enum.to_list/1
(flow 1.0.0) lib/flow/materialize.ex:642: anonymous fn/3 in Flow.Materialize.build_trigger/1
(flow 1.0.0) lib/flow/map_reducer.ex:87: Flow.MapReducer.done_status/4
(flow 1.0.0) lib/flow/map_reducer.ex:35: Flow.MapReducer.handle_cancel/3
(gen_stage 1.0.0) lib/gen_stage.ex:2096: GenStage.noreply_callback/3
Last message: {:DOWN, #Reference<0.1582286220.1330905089.229281>, :process, #PID<0.963.0>, :normal}
State: {%{#Reference<0.1582286220.1330905089.229281> => nil}, %{done?: false, producers: %{#Reference<0.1582286220.1330905089.229281> => #PID<0.963.0>}, trigger: #Function<2.13930487/3 in Flow.Window.Global.materialize/5>}, {0, 12}, {:cont, {:cont, %{}}}, #Function<4.74501935/4 in Flow.Materialize.build_reducer/2>}
13:22:31.158 [error] GenServer #PID<0.948.0> terminating
** (stop) exited in: GenStage.close_stream(%{})
** (EXIT) an exception was raised:
** (Protocol.UndefinedError) protocol Enumerable not implemented for {:cont, {:cont, %{}}} of type Tuple, Flow attempted to convert the stage accumulator into events but failed, to explicit convert your current state into events use on_trigger/2. This protocol is implemented for the following type(s): Flow, Date.Range, File.Stream, Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, List, Map, MapSet, Range, Stream
(elixir 1.10.3) lib/enum.ex:1: Enumerable.impl_for!/1
(elixir 1.10.3) lib/enum.ex:141: Enumerable.reduce/3
(elixir 1.10.3) lib/enum.ex:3383: Enum.reverse/1
(elixir 1.10.3) lib/enum.ex:2984: Enum.to_list/1
(flow 1.0.0) lib/flow/materialize.ex:642: anonymous fn/3 in Flow.Materialize.build_trigger/1
(flow 1.0.0) lib/flow/map_reducer.ex:87: Flow.MapReducer.done_status/4
(flow 1.0.0) lib/flow/map_reducer.ex:35: Flow.MapReducer.handle_cancel/3
(gen_stage 1.0.0) lib/gen_stage.ex:2096: GenStage.noreply_callback/3
(gen_stage 1.0.0) lib/gen_stage/stream.ex:160: GenStage.Stream.close_stream/1
(elixir 1.10.3) lib/stream.ex:1415: Stream.do_resource/5
(elixir 1.10.3) lib/stream.ex:880: Stream.do_transform/5
(elixir 1.10.3) lib/enum.ex:605: Enum.count/1
(pva 0.1.0) langfordSequence.ex:47: anonymous fn/4 in LangfordSequence.langfordSequence_p/2
(flow 1.0.0) lib/flow/materialize.ex:620: Flow.Materialize."-build_reducer/2-lists^foldl/2-0-"/3
(flow 1.0.0) lib/flow/materialize.ex:620: anonymous fn/5 in Flow.Materialize.build_reducer/2
(flow 1.0.0) lib/flow/map_reducer.ex:59: Flow.MapReducer.handle_events/3
Last message: {:"$gen_consumer", {#PID<0.947.0>, #Reference<0.1582286220.1330905090.228864>}, [[1, 0, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 1]]}
State: {%{#Reference<0.1582286220.1330905090.228864> => nil}, %{done?: false, producers: %{#Reference<0.1582286220.1330905090.228864> => #PID<0.947.0>}, trigger: #Function<2.13930487/3 in Flow.Window.Global.materialize/5>}, {0, 12}, %{}, #Function<4.74501935/4 in Flow.Materialize.build_reducer/2>}
** (exit) exited in: GenStage.close_stream(%{})
** (EXIT) exited in: GenStage.close_stream(%{})
** (EXIT) an exception was raised:
** (Protocol.UndefinedError) protocol Enumerable not implemented for {:cont, {:cont, %{}}} of type Tuple, Flow attempted to convert the stage accumulator into events but failed, to explicit convert your current state into events use on_trigger/2. This protocol is implemented for the following type(s): Flow, Date.Range, File.Stream, Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, List, Map, MapSet, Range, Stream
(elixir 1.10.3) lib/enum.ex:1: Enumerable.impl_for!/1
(elixir 1.10.3) lib/enum.ex:141: Enumerable.reduce/3
(elixir 1.10.3) lib/enum.ex:3383: Enum.reverse/1
(elixir 1.10.3) lib/enum.ex:2984: Enum.to_list/1
(flow 1.0.0) lib/flow/materialize.ex:642: anonymous fn/3 in Flow.Materialize.build_trigger/1
(flow 1.0.0) lib/flow/map_reducer.ex:87: Flow.MapReducer.done_status/4
(flow 1.0.0) lib/flow/map_reducer.ex:35: Flow.MapReducer.handle_cancel/3
(gen_stage 1.0.0) lib/gen_stage.ex:2096: GenStage.noreply_callback/3
(gen_stage 1.0.0) lib/gen_stage/stream.ex:160: GenStage.Stream.close_stream/1
(elixir 1.10.3) lib/stream.ex:1415: Stream.do_resource/5
(elixir 1.10.3) lib/stream.ex:880: Stream.do_transform/5
(elixir 1.10.3) lib/enum.ex:605: Enum.count/1
顺祝商祺
1条答案
按热度按时间vh0rcniy1#
Tuple类型的
{:cont, {:cont, %{}}}
未实现协议可枚举例如: