Last active
August 29, 2015 14:17
-
-
Save kjellski/2a25cc0c584b709f17e7 to your computer and use it in GitHub Desktop.
compress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let rec compress = function | |
| a :: b :: xss -> | |
if a = b then compress(b::xss) else a:: compress(b::xss) | |
| smaller -> smaller | |
let list = ["a";"a";"a";"a";"b";"c";"c";"a";"a";"d";"e";"e";"e";"e"] | |
string list | |
compress list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment