Last active
August 5, 2020 19:41
-
-
Save amscotti/ab713b73337af0c8e64055c55b1b665e 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
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