TF#I Friday #7 : In which it isn’t really Friday but there is some F#
After my simple start to an anagram solver in C#, I have a simple equivalent in F#:
let generateKey (chars : char[]) = new string(chars)
let lookup = words |> Seq.groupBy(fun x -> generateKey(x.ToCharArray() |> Array.sort))
The lookup function expects a list of strings. It works – although I’ve only tried it with fairly short lists of words. Next exercise is to try calling this (or something like it) from C#.
Advertisement