Events


11
Jun 12

NYC Progressive F# Tutorials 2012 in Retrospect

It was the best of times, it was the… Actually, it was all just fantastic.

On the beginner track Chris Marinos, Phil Trelford, and Tomas Petricek worked tirelessly in teaching F#. I was thoroughly impressed with the quality of their tutorials and would recommend seeking any of them out if you wish to become more proficient in F#. By the time we got to the contest at the end almost everyone was ready to compete with just a little help getting started.

On the advanced track attendees made type providers with Keith Battocchi, learned to use Adam Mlocek’s fantastic numerical computing library FCore (you can’t get any closer to Matlab syntax), and got some hands on time with the Microsoft Cloud Numerics team. Paulmichael Blasucci ran the contest on that side and noted that few had trouble and that the competition was just brutal.

On both sides the rooms were almost always packed and I didn’t hear a single complaint about the quality of the tutorials or speakers. Everyone was just thrilled to be there and stayed focused on learning the entire time. I’ve seen few conferences that kept the attendees so enthralled. Kudos to everyone involved for making such a great event happen.

Now, on to the links and materials (they’ll be updated as they come in).

Event Photos are up on Facebook!

Beginner Track:
- Chris Marinos’s F# Koans
- Phillip Trelford’s Writeup on Day 1 and Day 2

Advanced Track:
- Keith Battocchi’s Type Provider Tutorial Code and Slides/Docs
- Adam Mlocek and Tomas Petricek’s FCore Slides and Code
- Roope Astala’s Cloud Numerics Tutorial Slides and Tutorial Examples

Both Tracks:
I’m planning a Silverlight release of the contest code with the contestant sample AI in an upcoming blog post. For now, you can find the code in its github repo.

Social Media:
Chris Marinos’s Blog and Twitter
Phil Trelford’s Blog and Twitter
Tomas Petrice’s Blog and Twitter
Don Syme’s Blog and Twitter
The Cloud Numerics Blog
SkillsMatter on Twitter

Going Further:
F# Training in London and NY
FCore Library


10
Apr 12

F# Event Madness, Spring 2012 Edition

Upcoming Speaking Engagements:

Great Lakes Functional Programming Conference — May 5, Ann Arbor, MI

I’m very excited to be giving the Keynote at the first Great Lakes Functional Programming Conference, I’d suggest signing up but it’s already sold out!

Progressive F# Tutorials NYC - June 5/6, 2012 NYC

I’ve spent a ton of time over the last few months helping put together the first ever F# conference in the USA. Many of the most well known speakers from the F# community will be there giving hands on tutorials. There’s also both a beginner and advanced track so no matter your skill level you will certainly learn something.

CodeStock - June 15/16, 2012 Knoxville, TN

From what I hear, CodeStock is just about as much fun as you can legally have at a programmer conference. I’m proud to be giving one of four F# talks this year.

Recordings of Recent Events:

Why F#? With Richard Minerich and Phillip Trelford

Scott was kind enough to give us a shot at the “why should I use F# again?” question on his podcast. I hope Phil and I were able to convince at least a few folks to play with it a bit.

Barb: How I built a simple dynamic programming language in F#

I finally felt Barb was ready for show and tell at the NYC F# User Group. I would be grateful for any feedback you might have.


12
Dec 11

2011 In Retrospect: A Year of Writing F# Professionally

For the past year I’ve been working almost entirely in F# and have found the experience to be everything I hoped it to be and better. In just six months I was able to bring a research project to fruition which has since made our company millions of dollars. F#’s terseness made algorithms a joy to implement while F#’s type system made changes easy and regression errors non-existent. In fact, the few bugs we have had were either due to unexpected behavior in the GUI API, or in external C# libraries. Never before have I been so happy with the programming language I use on a daily basis. Never before have I felt so confident that when I make a change new bugs won’t be introduced. And no, we’re not using strict TDD, or any other strict development methodology. Simply leveraging the type system well in addition to algorithmic testing has proven to be extremely robust within F#.

It’s also been a great year for making new friends and meeting interesting people. The NYC F# community is thriving with an average of about fifty people attending any given NYC F# User Group meeting, many of them using F# at work for at least some subset of their projects. I hear the same experiences from many: Yes, learning F# isn’t simple, but the benefits in speed of implementation, LoC reduction, and correctness are huge. The excitement over type providers is also palpable. Finally, we’ll be able to extend our types out into data sources and eliminate new classes of error which currently occur at the border between our data and our applications. If you’re interested in following what we’ve been up to at the NYC F# User Group, check out our Vimeo stream.

I’ve also had the pleasure of speaking at a quite a few interesting events this year. One I haven’t yet written about is Monospace 2011.

Monospace, First Slide

Click For Video

In retrospect, it shouldn’t have been surprising that many in the Mono community hadn’t seen much F#.  They tend to go to different conferences and events than your standard .NET user and so hadn’t yet heard much about its benefits.  I will say though that it was a very bright group and I think many who speak on F# would find them  just as receptive as I have.  I do hope to see (and participate in) more outreach into the Mono world as I think we will find that there’s quite a few folks who would be happy to embrace a better way to program, if only they were shown the way.


3
Oct 11

Advice for Getting Started with F#

I had a great time at NYC Code Camp this last weekend. About half the people in my talk already knew F# and were there to talk about Type Providers, the other half just came to see what this F# thing was all about. This post is to help those in the second half begin their F# learning adventure.

The first thing anyone who is looking to get started with F# should do is work through the tutorial examples on tryfsharp.org. Getting some hands-on time with the basics is extremely important, especially if you haven’t done much functional programming before.

Once you’ve got the basics down, the next step is thinking through some real problems in F#. For me, this was writing an Ant Colony simulation. With the version linked to here you can actually compile and then try your own ant behavior code against mine! Other great options include the Coding Dojo Katas or Project Euler (for the mathematically inclined).

It’s best if you do most of your play using .fsx files and F# interactive at first. Just highlighting code and hitting Alt-Enter makes the process of learning so much faster. However, if you insist on working with unit tests I suggest Xunit as it doesn’t require the use of classes for hosting your tests.

At first it’s also best to ignore most of F#’s features, it can be overwhelming otherwise. Try your best to focus on comprehensions. These may not always be the best way to solve a problem, but they allow you to write very imperative code right in the middle of a bunch of functional stuff and so are kind of an escape hatch for when you don’t know how to do what you want functionally. Eventually you’ll want to move on to recursion and folding though. When you’re ready to make the jump read this post which talks about how to go about it.

As you’re playing with F#, don’t be afraid to look things up along the way when you get stuck. There’s quite a few good resources around for F# including the F# Programming WikiBook, the code samples provided by the F# team, and a number of print books including Professional F# 2.0 (shameless plug). When all else fails the MSDN documentation for F# is actually very good!

I can say from experience that at first you will likely experience quite a few syntax errors. Don’t worry too much about it, your brain needs to build up a model of how the types and syntax work. Once you’ve gotten over that hurdle I promise you’ll be amazed by how different the programming world looks.


5
Apr 11

F# and the DLR at Dev Day for NSWC Dahlgren

Just yesterday I gave a presentation on F# and the DLR for the Naval Surface Warfare Center. Many thanks to Kevin Hazzard and Chris Bowen for recommending me. It was a fantastic opportunity to speak on the benefits of F# to an entirely new audience and I learned a few things about the DLR along the way.

Despite disliking dynamic languages in practice because of their lack of safety, I must admit that the DLR allows you to do quite a few very interesting things.

First, you can embed DLR language code right into html and so build Silverlight applications with no backing assembly. This is quite interesting as it makes the web development story for Silverlight much more attractive. Read more about this feature on the DLR section of the Silverlight Website.

Second, it’s quite easy to embed DLR languages into your application. With just about three lines of code I was able to build a IronPython query window right into a ListView. The possibilities for live debugging and building query DSLs here are huge.

Finally, the DLR is a great platform for building your own DSL. You need only to Parse and Lex your way to a DLR abstract syntax tree, sprinkle in a few rules, and you’ve got your own language. This is also where I see the marriage of F# and the DLR as F# is an ideal language to do this in. For an example of a really nice implementation of a DLR language in F#, take a look at IronJS.

Click here to download my slides, as well as the code used in this presentation.


27
Mar 11

Some Recent Talks (with slides and code)

I’ve given quite a few talks over the last couple of months and at each and every one I promised to post my content shortly afterwards here on my blog.

However, due to some extreme laziness early on coupled with a crazy schedule and some unfortunate (but thankfully temporary) health problems more recently, I’ve failed to live up to those promises. Sorry guys, here’s the slides and code I promised. Better late than never, right?

How you can get started with F# today

I gave this talk at the local .NET meeting the monday night of the MVP Summit.  It’s a short (15 minutes) one-two punch of why you might care about F# and where you can find out more.  Very well received.

Getting the MVVM Kicked Out of Your F#’n Monads

This presentation is from the most recent NYC Code Camp. The title started out as a joke with Steve Bohlen, mentioning on twitter that all the submitted talks had to do with MVVM. I wasn’t really going to do it, but when he said he’d automatically accept something with such a title, I decided to use it as a chance to explain computation expressions to a room full of people new to F#. It actually went really well considering, the post-talk reviews were fantastic.

Fun and Games in F#

My MVP2MVP talk from the MVP summit’s very first F# track. It’s a meta-talk about how to give a good F# talk, and how to build a stronger F# community.

8
Feb 11

The Road to Functional Programming in F# – From Imperative to Computation Expressions

In F# there are a lot of options when it comes to choosing the style in which you will perform a computation.  So, for our last meeting of the the NYC F# User Group I decided to try and build a general understanding of how the different styles are related to each other through trying them and discussing our results. Come along with us and explore five of different styles of programming in F#.

For our example I chose Project Euler #1 as it’s simple and wouldn’t get in the way of contrasting the different computation styles.

Find the sum of all the multiples of 3 or 5 below 1000.

As there are a lot of people out there that are new to F#, let’s start with an imperative approach.  That way we can all feel comfortable and see how the other styles relate.

let pe1_while limit =
    let mutable acc = 0
    let mutable x = 0
    while x < limit do
        if x % 5 = 0 || x % 3 = 0 then acc <- acc + x
        x <- x + 1
    acc

pe1_while 1000F# Web Snippets

val pe1_while : int -> int

Full name: Untitled.pe1_while

val limit : int

type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType

val mutable acc : int

type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType

val mutable x : int

type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType

Next, let’s move on to doing the same thing recursively.  This transition is the first step on the long road of functional programming and it’s important that new users see how the two basic patterns map to each other.  For this reason, I kept everything but the style of computation the same.

let pe1_rec limit =
    let rec inner_pe1 x acc =
        if x < limit then
            if x % 5 = 0 || x % 3 = 0 then
                inner_pe1 (x + 1) (x + acc)
            else
                inner_pe1 (x + 1) acc
        else acc
    inner_pe1 0 0F# Web Snippets

val pe1_rec : int -> int

Full name: Untitled.pe1_rec

val limit : int

type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType

val inner_pe1 : (int -> int -> int)

val x : int

type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType

val acc : int

type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType

As you can see, the combination of the first if and the recursive calls correspond to the while statement.  The predicate remains the same.  The biggest conceptual hurdle for new users here is that for both predicates a course of action must be explicitly specified in both the success and failure case.

Another important idea here is that when doing recursion you don’t want to leave anything left undone on the stack. If you do, the compiler can’t do tail call optimization. Without tail call optimization each recursive call will create an additional stack frame. This slows things down and can even crash your program by overflowing the stack if the recursion goes too deep. As long as you don’t leave anything left undone your recursive function will run just as fast as a while loop.

I constructed this example with the thought that it would be best to avoid having to explain too many new constructs at once.  However, while discussing this solution one new user remarked that this looked like spaghetti code.  In response to this Paul, one of our more advanced users, whipped up a much nicer solution utilizing pattern matching.

let pe1_rec2 limit =
    let rec inner_pe1 acc = function
        | 1                     -> acc
        | i when (i % 3 = 0)
              || (i % 5 = 0)    -> inner_pe1 (acc + i) (i - 1)
        | i                     -> inner_pe1 acc       (i - 1)
    inner_pe1 0 (limit - 1) F# Web Snippets

val pe1_rec2 : int -> int

Full name: Untitled.pe1_rec2

val limit : int

type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType

val inner_pe1 : (int -> int -> int)

val acc : int

type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType

val i : int

type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType

Now that’s some pretty code!  While it may have some intermediate concepts, the recursion looks just beautiful when structured with a pattern match.

Still, to most I think this hardly seems worth giving up mutation for.  This is why we should move on to pipelines and comprehensions next.

let pe1_seq limit =
    seq { 0 .. limit - 1 }
    |> Seq.filter (fun x -> x % 5 = 0 || x % 3 = 0)
    |> Seq.sumF# Web Snippets

val pe1_seq : int -> int

Full name: Untitled.pe1_seq

val limit : int

type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType

Multiple items

val seq : seq<’T> -> seq<’T>

Full name: Microsoft.FSharp.Core.Operators.seq

——————–

type seq<’T> = System.Collections.Generic.IEnumerable<’T>

Full name: Microsoft.FSharp.Collections.seq<_>

type: seq<’T>
inherits: System.Collections.IEnumerable

module Seq

from Microsoft.FSharp.Collections

val filter : (‘T -> bool) -> seq<’T> -> seq<’T>

Full name: Microsoft.FSharp.Collections.Seq.filter

val x : int

type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType

val sum : seq<’T> -> ‘T (requires member ( + ) and member get_Zero)

Full name: Microsoft.FSharp.Collections.Seq.sum

While bound to perform somewhat slower due to the use of sequences, it’s hard to imagine a more conceptually elegant solution to this problem. In comparison to the imperative version, the sequence comprehension takes on the role of both the while loop and the incrementor in generating the sequence values, the filter acts as the predicate and the sum as the accumulator.

The final two examples I’ll show you were more for fun and to provide a challenge to the intermediate and experienced users.  Conquering folding and unfolding were some of the biggest hurdles I faced when learning functional programming.  Just getting comfortable with how accumulators work takes some time for everyone.  For practice let’s use fold in our pipeline instead of filter and sum.

let pe1_fold limit =
    Seq.init limit id
    |> Seq.fold (fun acc x -> if x % 5 = 0 || x % 3 = 0
                              then acc + x 
                              else acc) 0F# Web Snippets

val pe1_fold : int -> int

Full name: Untitled.pe1_fold

val limit : int

  type: int
  implements: System.IComparable
  implements: System.IFormattable
  implements: System.IConvertible
  implements: System.IComparable<int>
  implements: System.IEquatable<int>
  inherits: System.ValueType

module Seq

from Microsoft.FSharp.Collections

val init : int -> (int -> ‘T) -> seq<’T>

Full name: Microsoft.FSharp.Collections.Seq.init

val id : ‘T -> ‘T

Full name: Microsoft.FSharp.Core.Operators.id

val fold : (‘State -> ‘T -> ‘State) -> ‘State -> seq<’T> -> ‘State

Full name: Microsoft.FSharp.Collections.Seq.fold

val acc : int

  type: int
  implements: System.IComparable
  implements: System.IFormattable
  implements: System.IConvertible
  implements: System.IComparable<int>
  implements: System.IEquatable<int>
  inherits: System.ValueType

val x : int

  type: int
  implements: System.IComparable
  implements: System.IFormattable
  implements: System.IConvertible
  implements: System.IComparable<int>
  implements: System.IEquatable<int>
  inherits: System.ValueType

Here we took a somewhat different route when generating sequence values by using the Seq.init function.  As I discussed in my Ted Neward’s Folding Challenge post, the contents of the folding function can be directly mapped to the imperative and recursive solutions.  Just as in the first two examples the adding is done explicitly right along with the application of the predicate.   The biggest conceptual difference in this example is that the accumulator is passed as the return value of each call to fold instead of being kept in a mutable variable as in the imperative version or explicitly passed forward as in the recursive.

Finally, as a challenge to the most experienced users let’s see if we can do this with a computation expression.

type Euler1Builder() =
    member b.Combine(x, y) = x + y
    member b.Zero() = 0
    member b.Yield(x) = if x % 5 = 0 || x % 3 = 0 then x else 0
    member b.For(vals, f) =
        vals |> Seq.fold (fun s n -> b.Combine(s, f n)) (b.Zero()) 

let eb = new Euler1Builder()

let pe1_eb limit = eb { for x = 0 to limit - 1 do yield x }F# Web Snippets

type Euler1Builder =
class
new : unit -> Euler1Builder
member Combine : x:int * y:int -> int
member For : vals:seq<’a> * f:(‘a -> int) -> int
member Yield : x:int -> int
member Zero : unit -> int
end

Full name: Untitled.Euler1Builder

val b : Euler1Builder

member Euler1Builder.Combine : x:int * y:int -> int

Full name: Untitled.Euler1Builder.Combine

val x : int

type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType

val y : int

type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType

member Euler1Builder.Zero : unit -> int

Full name: Untitled.Euler1Builder.Zero

member Euler1Builder.Yield : x:int -> int

Full name: Untitled.Euler1Builder.Yield

member Euler1Builder.For : vals:seq<’a> * f:(‘a -> int) -> int

Full name: Untitled.Euler1Builder.For

val vals : seq<’a>

type: seq<’a>
inherits: System.Collections.IEnumerable

val f : (‘a -> int)

module Seq

from Microsoft.FSharp.Collections

val fold : (‘State -> ‘T -> ‘State) -> ‘State -> seq<’T> -> ‘State

Full name: Microsoft.FSharp.Collections.Seq.fold

val s : int

type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType

val n : ‘a
member Euler1Builder.Combine : x:int * y:int -> int
member Euler1Builder.Zero : unit -> int

val eb : Euler1Builder

Full name: Untitled.eb

val pe1_eb : int -> int

Full name: Untitled.pe1_eb

val limit : int

type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType

This first attempt is what I showed off at our user group meeting.  It’s embarrassingly ugly and ends up just being a convoluted way to generate a sequence and fold over the values.  Since the meeting I’ve fiddled with it a bit and have come up with a solution I like much more.

type Euler1Builder2() =
    member b.Yield(x) = if x % 5 = 0 || x % 3 = 0 then x else 0
    member b.For(generated, f) = generated |> Seq.map (fun x -> f x)
    member b.Run(filtered: int seq) = filtered |> Seq.sum 

let eb2 = new Euler1Builder2()

let pe1_eb2 limit = eb2 { for x = 0 to limit - 1 do yield x }F# Web Snippets

type Euler1Builder2 =
class
new : unit -> Euler1Builder2
member For : generated:seq<’a> * f:(‘a -> ‘b) -> seq<’b>
member Run : filtered:seq<int> -> int
member Yield : x:int -> int
end

Full name: Untitled.Euler1Builder2

val b : Euler1Builder2

member Euler1Builder2.Yield : x:int -> int

Full name: Untitled.Euler1Builder2.Yield

val x : int

type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType

member Euler1Builder2.For : generated:seq<’a> * f:(‘a -> ‘b) -> seq<’b>

Full name: Untitled.Euler1Builder2.For

val generated : seq<’a>

type: seq<’a>
inherits: System.Collections.IEnumerable

val f : (‘a -> ‘b)

module Seq

from Microsoft.FSharp.Collections

val map : (‘T -> ‘U) -> seq<’T> -> seq<’U>

Full name: Microsoft.FSharp.Collections.Seq.map

val x : ‘a

member Euler1Builder2.Run : filtered:seq<int> -> int

Full name: Untitled.Euler1Builder2.Run

val filtered : seq<int>

type: seq<int>
inherits: System.Collections.IEnumerable

Multiple items

val int : ‘T -> int (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.int

——————–

type int<’Measure> = int

Full name: Microsoft.FSharp.Core.int<_>

type: int<’Measure>
implements: System.IComparable
implements: System.IConvertible
implements: System.IFormattable
implements: System.IComparable<int<’Measure>>
implements: System.IEquatable<int<’Measure>>
inherits: System.ValueType

——————–

type int = int32

Full name: Microsoft.FSharp.Core.int

type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType

Multiple items

val seq : seq<’T> -> seq<’T>

Full name: Microsoft.FSharp.Core.Operators.seq

——————–

type seq<’T> = System.Collections.Generic.IEnumerable<’T>

Full name: Microsoft.FSharp.Collections.seq<_>

type: seq<’T>
inherits: System.Collections.IEnumerable

val sum : seq<’T> -> ‘T (requires member ( + ) and member get_Zero)

Full name: Microsoft.FSharp.Collections.Seq.sum

val eb2 : Euler1Builder2

Full name: Untitled.eb2

val pe1_eb2 : int -> int

Full name: Untitled.pe1_eb2

val limit : int

type: int
implements: System.IComparable
implements: System.IFormattable
implements: System.IConvertible
implements: System.IComparable<int>
implements: System.IEquatable<int>
inherits: System.ValueType

Instead of being like the fold example, this is much more like pipeline.  The only downside here is that the computation expression attempts to be as generic as possible and so we need a type annotation to make the example compile.  Overall, I think it ended up looking quite nice.  It’s also not nearly as complex as you might think.

Let me explain how each of the members of the computation expression fit together to make this work.  The builder’s For method allows us to use a for loop within our expression.  The values generated by that for loop are provided to the For method in the form of a sequence.  When For is called, it is passed that sequence along with a function which does whatever is scoped inside of our expression’s for loop.  In this case, that function is the builder’s Yield method because we are yielding each value.  Finally, the entire computation is preformed within the context of the Run method, which allows the input and output of the expression to be manipulated.  So, within our example we generate our values with For, filter them in Yield and then finally sum them in Run.

I hope you’ve enjoyed our journey through the different styles of computation in F#. The only style I think I didn’t cover here is continuation passing, which is more of a hack to get around the limits of recursion and linked lists anyway.  If you do think of something I missed, want to discuss something related or just feel like being friendly I hope you’ll leave a comment.


2
Feb 11

F# Code and Slides to Share

As I mentioned in my most recent edition of F# Discoveries This Week, it’s Code Camp season and it would be great to see more F# users out there sharing the love.  To help out, I’ve provided the slides from my previous talks in one place under the Creative Commons Attribution license.  I even left all of my slide notes intact.  Do anything you want with them, but please do it in the spirit of spreading F#.

Of course, this applies only to my own slides and code.  Everything made by someone else maintains its existing license.  Duh.

As evidenced by this picture of Don Syme, speaking on F# is guaranteed to make you look at least 200% more awesome

F# and You!

This was my go-to intro to F# talk for almost two years.  It’s a whirlwind tour through F# with an emphasis on conveying why F# is good over how to use it or how it works.  I’ve given variations of this talk over 10 times, and it’s always a crowd pleaser.

Functional Language Paradigms in F#

I gave this talk at the NYC ALT.NET Group shortly before moving to NYC.  It may just be my most well received talk of all time.  If you use this, you’ll need to switch up the questions so people can’t just look up the answers online beforehand.

F# For Testing and Analysis

This talk is an overview of some of the tools available for F# and how to use them.  It’s one of my favorite talks for intermediate F# users.  FsCheck always blows the minds of those who are engineering-minded.

A Lap Around the F# Ecosystem

While similar to F# for Testing and Analysis, this talk focuses on some great tools not involved in testing.  For example, I give FAKE some love.

F# 2.0 – A Day at the Beach

This is the content for my CUFP tutorial.  Giving this talk involved a ton of answering questions and walking around helping directly.  The code is a bit dated, I have a much more recent Silverlight version you can use instead.

F# in the Lab and the Classroom

This was my first attempt at spreading F# in academia and I think it went much better than I expected.  My favorite part is the comparison of a pseudo decision tree with F#’s match statement.

Love the Lambda

This talk is a bit of an unfinished project.  The basic idea is that F# allows you to implement features that would requite compiler changes in languages like C# and VB.NET.  I’ve given it only once with mixed results, but I think it has a lot of potential.

I’ve given a few others but they’ve either been composites of what I posted here or are so old that none of the samples would work now.  I hope that by providing these here I’ve inspired at least one other person to get out there and share the F# love.

I’d love to hear about how you used these slides or answer any questions you might have.  The best way to get in touch is with twitter.


11
Dec 10

An F# Ant Colony Simulation in Silverlight 4.0 with Dynamic AI Loading

I’ve been enviously watching Phillip Trelford publish excellent F# games all week and tonight I just couldn’t stand it anymore.  I stayed in, rolled up my sleeves and ported the very same ant colony simulation I used in my CUFP workshop to Silverlight 4.0.

Install Microsoft Silverlight

Wow, just look at those little guys go at it.  Silverlight sure is pretty!

As you might have noticed by the big white “Click To Load Custom AI” message, you can also compile your own AI and battle it out with what I’ve included here.  To make things easy I’ve provided a ready to go solution.  Simply load it up, compile it and select the compiled DLL.

Once you’ve loaded your AI the game will immediately start.  Best of luck to you against my little monsters, so far they’ve been undefeated.  If you happen to come up with an ant-dominating example I hope you’ll post it here in the comments.  There were some really creative ideas in the CUFP workshop and I’d love to see what could be done with more than just four hours.

If your interested in the gory details of the simulation itself, I’ve put up a github repository with the entirety of the code.  And just in case you’re wondering, I’m still planning on running that contest.  Expect a ton of cool new AI features and a big focus on combat.

Cheers!

Update:  I’ve mucked with a few things.  Mainly, it will be a bit nicer when handling AI exceptions now.  While I was at it I tweaked some of the game world parameters and so you’ll need to re-download the example solution if you already have it.


1
Dec 10

In Retrospect: The F# in Education Workshop

I was taking the elevator down after getting settled in my hotel room and as the doors opened I was awestruck by the sight of Don Syme sitting on a couch, typing away on his laptop. With a bit of trepidation I walked up to him and introduced myself.  It was immediately obvious that he was both a very friendly fellow and very excited about something in particular.

Don turned his laptop to me and said “look at this”. It was a blog post detailing the release of F# under the Apache 2.0 license. Needless to say, my mind was blown. I was dumbstruck.

Don Syme announcing to the world that F# would forever be under the Apache 2.0 license. (Photo courtesy of Migel de Icaza)

We then proceeded to dinner in the hotel restaurant. Miguel de Icaza was there, and if you know Miguel you know he’s the life of the party. He became even more animated when told about F# becoming open source and pledged to get the source integrated into Mono as soon as possible.

Later that night the Hotel turned into some kind of giant dance party and fashion show.  Thinking of the day ahead we all returned to our rooms.  I did sneak back down later though to grab a celebratory book-publishing nightcap with Ted Neward.  It’s old hat for him, but I’m still reeling from it.

Announcing Professional F# 2.0! (Click for Video)

To be honest, I was a bit intimidated by the idea of speaking to a room full of PhDs. Because of this, I put far more thought and practice into this 30-minute presentation than any of the much longer talks I had given before. Having my material down pat, I was able to turn that anxiety into gusto with what I feel was great success.

While presenting I noticed that the entire room was laughing at my jokes at first but by the end most seemed rather serious.  I took this to mean that many were offended by my critique of current teaching techniques. Had I been too heavy handed with my language?

Afterward my fears were allayed by the enthusiasm of those who came and spoke with me. Later, a swath of positive reviews confirmed that, while I may have been skirting the edge, I hadn’t gone too far.  Even so, I think I’ll try to be a bit softer in my approach in the future.  As they say, you attract more flies with honey than with vinegar.

Judith Bishop
Queen of Microsoft Research

Miguel de Icaza
Lord of all things Mono

Tomas Petricek
F# Jedi

Joe Pamer
Tamer of F# Compiler Lions

Photos Courtesy of Microsoft Research

That night I had dinner and drinks with some of the most brilliant people. Conversation ranged from type systems to the future of F# and Mono. I ended up staying up quite late talking with Tomas about his future plans. It looks as though he has a ton of great stuff for the F# community right on the horizon.

Howard Mansell
The F# Prophet of Credit Suisse

Richard Minerich
Who invited that guy anyway?

Photos Courtesy of Microsoft Research

The next day Howard and I took the train back to New York and discussed our plans for NYC-wide F# domination. Howard is almost single-handedly responsible for Credit Suisse’s rise as one of the biggest F# using companies. They now number over 100 F# users strong and continue to grow. Combined, we might just be unstoppable.

All-in-all I’d say that the event was a great success both personally and for F#. In a couple of years we’ll see some of the first big batches of graduates educated in statically typed functional programming. At that point, those the imperative object oriented camp will need to start playing catch-up.