Created
September 4, 2012 12:48
-
-
Save arsatiki/3620873 to your computer and use it in GitHub Desktop.
Excercise 4.3
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 translate = function | |
'A' -> 'C' | 'B' -> 'A' | 'C' -> 'D' | 'D' -> 'B' | |
| _ -> invalid_arg "Not a plaintext string";; | |
let stringtail s = | |
String.sub s 1 (String.length s - 1);; | |
let rec check s1 s2 = | |
match (s1, s2) with | |
("", "") -> true | |
| ("", _) -> false | |
| (_, "") -> false | |
| _ -> if translate s1.[0] = s2.[0] then | |
check (stringtail s1) (stringtail s2) | |
else false;; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment