Last active
April 26, 2016 19:21
-
-
Save Andrea/00805cabade7a62109fb793cccda8221 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
open System | |
type Result = | |
| IsPanagram | |
| NotPanagram | |
let (|RightSize|) (s:string) = s.Length > 1 && s.Length < 1000 | |
let isPanagram (s: string) = | |
let checkActual aceptedChar (s:string) = | |
let phraseSet = s.ToLower().Replace(" ", String.Empty) |> Set.ofSeq | |
let acceptedSet = Set.ofSeq aceptedChar | |
if phraseSet.IsSupersetOf acceptedSet then IsPanagram | |
else NotPanagram | |
match s with | |
| RightSize true -> checkActual (seq ['a'..'z']) s |> Some | |
| _ -> None | |
let pan = "The quick brown fox jumps over the lazy dog" | |
let pan2 = "The quick brown fox jumps over the lazy dog." | |
let s = @"We promptly judged antique ivory buckles for the next pri " | |
isPanagram pan | |
isPanagram "ee" | |
isPanagram s | |
isPanagram pan2 | |
isPanagram "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment