Guest User

Untitled

a guest
Aug 30th, 2015
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.47 KB | None | 0 0
  1. open Char
  2.  
  3. let voyelle c =
  4.     match lowercase c with
  5.     | 'a' | 'e' | 'i' | 'o' | 'u' | 'y' -> true
  6.     | _ -> false
  7.  
  8. let consonne c =
  9.     match lowercase c with
  10.     | 'a' .. 'z' when not (voyelle c) -> true
  11.     | _ -> false
  12.  
  13. let soc c =
  14.     String.make 1 c
  15.  
  16. let swe_of_fr c =
  17.     if (consonne c) then (soc c)^"o"^(soc (lowercase c)) else (soc c)
  18.  
  19. let rajkcqoinoqeiufbi s =
  20.     let rec loop ns i =
  21.         if i < String.length s then loop (ns^(swe_of_fr s.[i])) (i+1) else ns
  22.     in loop "" 0
Advertisement
Add Comment
Please, Sign In to add comment