Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
420 views
in Technique[技术] by (71.8m points)

Erlang exception error: no function clause matching

Can you please tell me what's wrong in line 53 of the code? As i understand it should return {[{12456},{77777}, {99999}, {88888}], []}. Why is not matching and how to fix it? Thank!

fu() ->
Tr = [{12456},{77777}, {99999}, {88888}],
car:foa1(Tr, {[],[]}).

foa1([], Acc) -> Acc;

foa1([{Tr}|Ot], {A1,A2}) ->
Direction = unknown,
A = fun(T, {Acc1, Acc2}) ->
case Direction of
unknown -> {[T | Acc1], Acc2};
_ -> {Acc1, [T | Acc2]}
end
end,
{Acc1, Acc2} =  lists:foldl(A, {[],[]}, Tr),
foa1 (Ot, {A1 ++Acc1,  A2 ++ Acc2}).

** exception error: no function clause matching lists:foldl(#Fun<car.0.18093156>,{[],[]},12456) (lists.erl, line 1262) in function car:foa1/2 (car.erl, line 53)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The issue is resolved! I have corrected the format of the list sent to work. Thanks to all


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...