Move the lists:reverse() in make_chains() to preserve input's order in the output
This commit is contained in:
parent
e791876212
commit
d2562588f2
1 changed files with 1 additions and 1 deletions
|
@ -566,7 +566,7 @@ make_chains(ChainLen, FLUs) ->
|
||||||
make_chains(ChainLen, FLUs, [], []).
|
make_chains(ChainLen, FLUs, [], []).
|
||||||
|
|
||||||
make_chains(_ChainLen, [], SmallAcc, BigAcc) ->
|
make_chains(_ChainLen, [], SmallAcc, BigAcc) ->
|
||||||
lists:reverse([SmallAcc|BigAcc]);
|
[lists:reverse(SmallAcc)|BigAcc];
|
||||||
make_chains(ChainLen, [H|T], SmallAcc, BigAcc) ->
|
make_chains(ChainLen, [H|T], SmallAcc, BigAcc) ->
|
||||||
if length(SmallAcc) == ChainLen ->
|
if length(SmallAcc) == ChainLen ->
|
||||||
make_chains(ChainLen, T, [H], [SmallAcc|BigAcc]);
|
make_chains(ChainLen, T, [H], [SmallAcc|BigAcc]);
|
||||||
|
|
Loading…
Reference in a new issue