Re.Mark

My Life As A Blog

Archive for June 2011

TF#I Friday #7 Part 2 : In which it still isn’t Friday

leave a comment »

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…

Written by remark

June 29, 2011 at 3:09 pm

Posted in .NET, c#, Development, F#

TF#I Friday #7 : In which it isn’t really Friday but there is some F#

leave a comment »

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#.

Written by remark

June 29, 2011 at 11:45 am

Posted in .NET, Development, F#, Languages