Skip to content

Instantly share code, notes, and snippets.

@amscotti
Last active August 5, 2020 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amscotti/ab713b73337af0c8e64055c55b1b665e to your computer and use it in GitHub Desktop.
Save amscotti/ab713b73337af0c8e64055c55b1b665e to your computer and use it in GitHub Desktop.
let firstUnique (word: string): char option =
word
|> Seq.countBy id
|> Seq.filter (snd >> (=) 1)
|> Seq.map fst
|> Seq.tryHead
[<EntryPoint>]
let main argv =
match argv |> Seq.tryHead |> Option.bind firstUnique with
| Some c -> printfn "First unique letter is '%c'" c
| None -> printfn "Didn't find any unique letter"
0 // return an integer exit code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment