Skip to content

Instantly share code, notes, and snippets.

@Andrea
Last active April 26, 2016 19:21
Show Gist options
  • Save Andrea/00805cabade7a62109fb793cccda8221 to your computer and use it in GitHub Desktop.
Save Andrea/00805cabade7a62109fb793cccda8221 to your computer and use it in GitHub Desktop.
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