Tag Archives: F#

Generating Permutations: Clojure or F#: Part 2

Marching on from the last post. Lazy Sequences This is my favorite feature ever. If I want to generate just a few of 10! (nobody even knows how much that is) permutations, I could: provided, the function is defined (as described in the first post): Here I am not sure which language I like more. […]


Modelling Stochastically Independent Processes with F# Computation Expressions: Part 1

The idea for doing this is not new. There is an excellent series of posts closely tracing an article on applications of functional programming to probability. A colleague of mine has recently called my attention to his own post of two years ago, where he describes a monad that models stochastically independent events in Clojure. […]


How to use the HDF5 Type Provider

A friendly reader left a comment reminding me that I never really told how the HDF5 Type Provider is used in a Visual Studio F# code project. In this post – sample code It has been a while since I last took a look at the HDF5 type provider example – or any F# type […]


Super skinny XML document generation with F#

I needed to generate some simple XML documents, in memory, from some F# script. From my C# days I was already familiar with the System.Xml.Linq namespace, which I still quite like. But it wasn’t particularly clean to use from F#. So I wrote a really simple F# wrapper for some of its most commonly used […]


Super fast way to extract width/height dimensions of PNG and JPEG images

Turns out that getting the width and height of an image file can be quite tricky if you don’t want to read the whole file into memory. The System.Drawing.Image type in .NET will read it all into memory; not good. So I read the PNG and JPEG specifications and came up with this. PNG was […]


OS-X and F# [Clone It, Build It, Install It, Hack It]

Mission: Get F# running on OS-X and executing via repl.


Sorting part 1

I think that sorting algorithms are good starting point in learning programming. So let’s look how to implement sorting in F#. On fsharpforfunandprofit page we have a great example of how to implementing quicksort. The code is so compact! Just look at it: In this example we are partition list by by the first element. But […]