Speech Recognition is gun and easy!

Evidently Microsoft ninjaed a new assembly into the .NET framework with the 3.0 release called System.Speech.dll. If adding speech recognition or speech synthesis to your applications sounds like fun, read on. Step 1: Train your computer The first step for meaningful speech recognition is to tell your computer who is in charge. Open up the…


Pattern matching snippets

#light   open System   // ************************************************************* // * Pattern matching using match/with // *************************************************************   // This is not legal, since DateTime.Today is a variable… let dayDescriptor1 (day : DateTime) =     match day with     | DateTime.Today -> “today”     | _ -> “not today”   // This is however, since the ‘when…


fslex Sample

You may have heard of two tools that come with the current F# distribution, fslex and fsyacc. Both of those are based famous tools which are helpful in writing compilers.   In this post I’ll focus on creating a simple program which will take advantage of fslex, derived from Lex which stands for Lexical Analyser….


F# Snippet – Enums and Discriminated Unions

I was writing some F# code this week and ran into problem. Consider the following code:   type Thingey = This | That | SomethingElse   Which looks like an enum. So I assumed that, like things inheriting from System.Enum, an instance of the type had a ToString method which did the right thing. But,…


F# and Markov Chains, oh my!

Edit 2/8/2010: Updated syntax for latest F# language.   Recently I started playing a collectable card game after some friends got me into it. (Who themselves got back into it after some friends of theirs started playing. Witness the economic potential of viral card games!) As it turns out, I am a pretty poor card…


F# Snippets 01

This week I had the pleasure of writing some of our test automation infrastructure in F#. Not only does this give us a chance to dogfood the language, but it also helps us find pain points in the developer experience. For me at least, the biggest pain point right now is a lack of F#…