Phillip Trelford's Array

POKE 36879,255

FsiBot: Assorted Tweets

FsiBot is a cloud hosted bot that evaluates F# expressions in mentions, built by Mathias Brandewinder. Underneath it uses the Twitter API, F# Compiler Services all hosted on Azure.

In the beginning the F# community put a lot of effort into bringing it down testing it’s security. Nowadays it’s become more of a creative outlet for code golf enthusiasts showcasing all sorts from ASCII Art to math.

Christmas Tree

Tomas’s tree first appeared before @fsibot was cool or for that matter even existed:


An early attempt at ASCII art, the trick in Twitter is to use characters that are roughly the same width:


Along similar lines this expression uses a bitmap to produce an ASCII invader:

FSharp Logo

Here Mathias uses the same technique to generate a logo:

Bar chart

This expression charts Yes vs No in the recent vote on Scottish Independence:


The hailstone sequence:


Interesting Pi approximation using dates:


Evaluating an F# expression inside an F# expression:

Rick Roll

The thing about a rick roll is that no-one should expect it:

Magic 8-Ball

Based on magic 8-ball here's a somewhat abridged version:

Have fun!

Machine Learning Hands On Session

Last night the F#unctional Londoners Meetup put on a Hands On Machine Learning session at Skills Matter in London. It was a really well attended event, so much so that we had to put a cap on the number of attendees when we reached 70 registrations. The material was recycled from a well received session by Mathias Brandewinder at the San Francisco Bay Area F# User Group in May.

I find F# a very good fit for Machine Learning, in fact my first use of F# was for the player matchmaking on Halo 3.

The goal of the session was to create a digit recognizer using Kaggle’s competition data set.

The first part of the session was to parse and transform the provided CSV files:

let path = @"c:\Digits\digitssample.csv"
let lines = File.ReadAllLines(path)
lines |> (fun line -> line.Split(','))

Then to implement the K-nearest neighbours algorithm to classify digits. KNN is the first algorithm explained in Manning’s Machine Learning in Action book.


We used a guided script in the session that takes you through the problem in small manageable tasks, each one introducing the necessary F# language contructs required, which you could work through at home too.

Thanks for all the kind feedback:

  1. Finn NeuikFinn Neuik@finnneuik

    great evening at #fsharp UG courtesy of #kaggle, @skillsmatter and @ptrelford : I do like a bit of machine learning!

  2. James CrowleyJames Crowley@JamesCrowley

    Great evening learning some F# and machine learning with the help of @ptrelford @skillsmatter - thanks Phil!

  3. Andy BrackleyAndy Brackley@andybrackley

    Thanks @ptrelford for a great session on machine learning in f#. Excellent content and presentation

  4. Chris AustinChris Austin@cja117

    @ptrelford thanks for a great #fsharp workshop at #SkillsMatter in London.

If you’re interested in learning more check out:the Machine Learning with F# page on the F# Software Foundation site which includes plenty more tutorials.

Progressive F# Tutorials London 2012

First things first, a big thanks to the team at Skills Matter particularly Wendy and Anaïs for making this event happen.


This year the tutorials were held over 2 days in the atmospheric Crypt in Clerkenwell:

Progressive F# PanelProgressive F# Panel Progressive F# PanelSimon Cousins & Tomas Petrick

Expect a return next year in London and New York.

Day 1


Practical Functional-first Programming with F#


Friends don't let friends use null

An outstanding keynote from Don which built on the talk he gave at the Progressive .Net Tutorials earlier in the year, stacked full of nuggets. On measuring if you have a correctness problem in your code base Don suggests counting the occurrences of NullReferenceException in your bug database.

Don also demonstrated F# 3.0’s Type Provider feature, including a very interesting Hive type provider for Hadoop written by Matt Moloney.


Programming with the stars!


I generally avoid 'function' when showing the language to newcomers. Not a problem at #progfsharp :-)


i'm going to the Progressive F# Tutorials at #SkillsMatter Nov 1-2 intense coding with the greats of #Fsharp!

To demonstrate how to tackle problems with F#, Tomas & Nicolas neatly solved the Reversi kata live on stage. They started by transforming a board to a 2D array and then searched the array for legal moves.


F# Koans


Ready for some koans fun at #progfsharp!

The F# Koans are a simple, fun, and interactive way to learn the F# language through testing. You can run them from VS2010 or VS2012. My 10yo really enjoyed working his way through them.


Processing concurrent time-series data


See you at the Progressive F# Tutorials 2012


Not to miss #fsharp events! Tutorials at #skillsmatter in 2 weeks & Type-providers and financial tutorial at #techmesh…

Simon worked through some of the techniques he has used while developing solution in F# at E.ON Energy Trading for the last 4 years. There was also some ASCII art


Expert Panel Discussion


A very lively and fun debate, covering topics from industrial use of F#, cross-platform with Mono and the JVM, to data parallelism. Jon offered that several teams at Aviva, one of the world’s largest insurers, are using F#. Martin felt that F# on the JVM would be a smash hit. Finally Nick wetted our appetite for the upcoming release of {m}brace.


Day 2


Accelerate your TDD cycle – Coding dojo with NaturalSpec and NCrunch

sforkman turns out the whole "in the crypt" thing - not a joke. #progfsharp

In this session Steffen introduced TDD with F# using NaturalSpec and NCrunch.


Make Music in the Key of F#


@AnaisatSM thanks for having us, it really was a lovely event! /cc@skillsmatter @wendydevolder @ptrelford


Robert introduced Undertone a library for creating notes in F#, part inspired by Clojure’s Overtone. With the F# Koans under his belt my 10yo was able to translate the Baa Baa Black Sheep sample to Jingle Bells :)


F# in the Cloud


In this session, George and Gian demonstrated that F# can be used to perform computations in a cloud environment, using distributed actors, Azure Hadoop and the cool F# newcomer, {m}brace.


Web Programming


James started by talking through the F# MVC project template from Daniel Mohl.

After a short tea break I demonstrated some F# 3 type providers starting with accessing Stack Overflow’s API using the F# team’s OData type provider, followed by the file system and Freebase providers which are available in FSharpx via Nuget. Finishing up with a demo of the F# team’s B-Movie Madness sample web application which I’ve deployed on Azure.

James followed on with a site built using tube passenger statistics from TfL and a CSV type provider. Finally James demonstrated WebSharper compiling F# code directly to JavaScript.


Community Action

Thanks for stopping by, hope to see y’all at some of the upcoming fun F# community events: