Archive for June 2011
Looking at how to call F# from C#, I thought I should share this link. I have 2 projects in one solution (one in F# and one in C#.) The C# project (a console application) references the F# project (a library) and that works. Doesn’t do anything useful yet, but one step at a time…
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#.