Last week I had the pleasure of popping down to sunny Southampton to deliver an F# introduction talk to the local branch of the very friendly and receptive NxtGenUG. Attached are the slides. If you are interested in video, I have given very similar talks at:
One examples I gave was taking the C# class reference example from MSDN and implementing it in F#.
class Child
{
private readonly int age;
private readonly string name;
public Child(string name, int age)
{
this.name = name;
this.age = age;
}
public override string ToString()
{
return String.Format("{0} {1}", name, age);
}
}
F# Class:
type Child(name,age) =
member this.Name = name
member this.Age = age
override this.ToString() =
sprintf "%s %d" name age
F# Record:
type Child = { Name:string; Age:int } with
override this.ToString() =
sprintf "%s %d" this.Name this.Age
F# Discriminated Union:
type Child = Child of string * int
with override this.ToString() =
this |> (fun (Child(name,age)) ->
sprintf "%s %d" name age)
Thanks again to everyone who attended for making it fun and some great questions.
FSharp Intro NxtGen UG So'ton.pptx (657.07 kb)
FSharpDemos.zip (120.81 kb)