Unison speed test

tripleo - Nov 5 - - Dev Community

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)
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

https://dev.to/petets/property-based-testing-in-unison-2knp

. .
Terabox Video Player