Unison speed test

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 (…


This content originally appeared on DEV Community and was authored by tripleo

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

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


This content originally appeared on DEV Community and was authored by tripleo


Print Share Comment Cite Upload Translate Updates
APA

tripleo | Sciencx (2024-11-05T04:11:23+00:00) Unison speed test. Retrieved from https://www.scien.cx/2024/11/05/unison-speed-test/

MLA
" » Unison speed test." tripleo | Sciencx - Tuesday November 5, 2024, https://www.scien.cx/2024/11/05/unison-speed-test/
HARVARD
tripleo | Sciencx Tuesday November 5, 2024 » Unison speed test., viewed ,<https://www.scien.cx/2024/11/05/unison-speed-test/>
VANCOUVER
tripleo | Sciencx - » Unison speed test. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/11/05/unison-speed-test/
CHICAGO
" » Unison speed test." tripleo | Sciencx - Accessed . https://www.scien.cx/2024/11/05/unison-speed-test/
IEEE
" » Unison speed test." tripleo | Sciencx [Online]. Available: https://www.scien.cx/2024/11/05/unison-speed-test/. [Accessed: ]
rf:citation
» Unison speed test | tripleo | Sciencx | https://www.scien.cx/2024/11/05/unison-speed-test/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.