Skip to content

Commit bb287db

Browse files
author
immidisa
committed
Bug Fix/My Wrong code in Worker
1 parent be25dd9 commit bb287db

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/febonacci_worker.erl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,11 @@ handle_call({compute,Input}, _From, State) when is_list(Input) ->
8181
case Input=:=lists:sort(Input) of
8282
true ->
8383
Result = compute_fibonacci(Input),
84-
lists:foreach(fun(Elem)->
85-
[FirstR|_]=Result,
86-
ets:insert(feb_result,{Elem, FirstR}),
87-
ets:update_counter(input_count, Elem, {2, 1}, {Input, 0})
84+
lists:zipwith(fun(IElem,RElem)->
85+
ets:insert(feb_result,{IElem, RElem}),
86+
ets:update_counter(input_count, IElem, {2, 1}, {IElem, 0})
8887
end,
89-
Input),
88+
Input,Result),
9089
{reply, Result, State};
9190
_ ->
9291
{reply, "Input list should be sorted one", State}

0 commit comments

Comments
 (0)