Permalink
Browse files

vclock: simplifying merge/3 using lists:reverse/2.

  • Loading branch information...
1 parent e58c769 commit d3dd32aef4cd63ae3ce50e37a9ff4b202bc015f3 @esstrifork esstrifork committed with Vagabond Apr 8, 2011
Showing with 2 additions and 3 deletions.
  1. +2 −3 src/vclock.erl
View
@@ -82,9 +82,8 @@ merge([], NClock) -> NClock;
merge([AClock|VClocks],NClock) ->
merge(VClocks, merge(lists:keysort(1, AClock), NClock, [])).
-merge([], [], AccClock) -> lists:reverse(AccClock);
-merge([], [Left|Rest], AccClock) -> merge([], Rest, [Left|AccClock]);
-merge(Left, [], AccClock) -> merge([], Left, AccClock);
+merge([], Left, AccClock) -> lists:reverse(AccClock, Left);
+merge(Left, [], AccClock) -> lists:reverse(AccClock, Left);
merge(V=[{Node1,{Ctr1,TS1}}|VClock],
N=[{Node2,{Ctr2,TS2}}|NClock], AccClock) ->
if Node1 < Node2 ->

0 comments on commit d3dd32a

Please sign in to comment.