I wonder which one is faster, and which one is correct, of the following two:
Their:
base.List.compress: [a] -> [a]
base.List.compress as = case as of
[] -> []
[x] -> [x]
[x, y] ++ rest ->
if (x == y) then base.List.compress (y +: rest)
else x +: base.List.compress (y +: rest)
Mines:
base.List.compress: [a] -> [a]
base.List.compress as = case as of
[] -> []
[x] -> [x]
[x, y] ++ rest ->
if (x == y) then base.List.compress (y +: rest)
else (x +: y) +: base.List.compress rest