Created
June 2, 2013 19:50
-
-
Save davidgrenier/5694694 to your computer and use it in GitHub Desktop.
Identify a run of consecutive characters.
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 (|Run|_|) n c = | |
let rec identicals n = function | |
| rest when n = 0 -> Some rest | |
| a :: rest when a = c && n > 0 -> identicals (n - 1) rest | |
| _ -> None | |
identicals n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment