Unison speed test
tripleo

tripleo @tripleo

Joined:
Jun 26, 2023

Unison speed test

Publish Date: Nov 5 '24
0 0

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

Comments 0 total

    Add comment