fork download
  1. let vowels = "aeiou".ToCharArray()
  2. let IsVowel letter = Array.exists (fun vowel -> letter = vowel) vowels
  3. let IsConsonant letter = not (IsVowel letter)
  4. let WhereLetter func letter = if func letter then letter.ToString() else ""
  5.  
  6. let Disemvowel (input: string) =
  7. let fromInput = input.Replace(" ","").ToLower()
  8. printfn "%s" input
  9. printfn "%s" (String.collect (WhereLetter IsConsonant) fromInput)
  10. printfn "%s" (String.collect (WhereLetter IsVowel) fromInput)
  11. printfn ""
  12.  
  13. [<EntryPoint>]
  14. let main argv =
  15. Disemvowel "two drums and a cymbal fall off a cliff"
  16. Disemvowel "all those who believe in psychokinesis raise my hand"
  17. Disemvowel "did you hear about the excellent farmer who was outstanding in his field"
  18. //System.Console.ReadLine() |> ignore
  19. 0 // return an integer exit code
Success #stdin #stdout 0.08s 11712KB
stdin
Standard input is empty
stdout
two drums and a cymbal fall off a cliff
twdrmsndcymblfllffclff
ouaaaaoai

all those who believe in psychokinesis raise my hand
llthswhblvnpsychknssrsmyhnd
aoeoeieeioieiaiea

did you hear about the excellent farmer who was outstanding in his field
ddyhrbtthxcllntfrmrwhwststndngnhsfld
ioueaaoueeeeaeoaouaiiiie