Testimonials

"Your F# Journal has kept me engrossed for the past hour. Hats off to you. I honestly added it on a whim when I purchased Visual F# 2010 for Technical Computing. Looks like it'll be money well spent!" - Matt Harrington, University of California.

Free articles

"Microsoft's F# programming language is a functional language for the .NET framework that was originally developed at Microsoft Research Cambridge by Don Syme. In October 2007, the senior vice president of the developer division at Microsoft announced that F# was being officially productized to become a fully supported .NET language and professional developers were hired to create a team of around ten people to build the product version. In September 2008, Microsoft released the first Community Technology Preview (CTP), an official beta release, of the F# distribution. In December 2008, Microsoft announced that the success of this CTP had encouraged them to escalate F# and it will now be shipped as one of the core languages in Visual Studio 2010, alongside C++, C# 4.0 and VB..."

If you would like to see articles on a particular topic then please register on-line and let us know.

Contents

The following articles are currently available only to subscribers:

How to Leverage Pattern Matching (16th April 2007)

"Compared to conventional programming languages, F# takes dynamic dispatch to a whole new level using an approach called pattern matching. This article guides the reader through the fundamental concepts that underpin pattern matching before providing some examples demonstrating the power of pattern matching in general programming..."

The Essence of Functional Programming (30th April 2007)

"F# is fundamentally a functional programming language and the use of functions instead of objects often leads to shorter and clearer code. Indeed, many of the benefits of functional programming are already known to OO programmers in the form of design patterns..."

F# Development in Visual Studio 2005 (14th May 2007)

"The F# distribution includes extensions to Microsoft Visual Studio that provide a rich development environment for F# programmers. In this article, we shall describe how this development environment can be setup and used to make development as easy and productive as possible..."

"In addition to functional programming, the F# language also offers object-oriented programming (OOP) in harmony with the .NET platform. The F# language takes powerful OOP concepts from C# and supplements them with elegant functional constructs. The result combines the best aspects of functional and object-oriented programming..."

Using the built-in Data Structures (15th June 2007)

"The .NET framework provides a wide variety of mutable data structures and the F# standard library supplements these with several immutable data structures that provide elegant functional interfaces. This article describes many of the built-in data structures, how they are used and when they are most applicable..."

Designing and implementing a Sudoku Solver (30th June 2007)

"This article walks through the design and implementation of a complete GUI application for solving Sudoku puzzles. This is perhaps the smallest interesting GUI application that demonstrates many different advantages of the F# programming language, including functional programming and .NET interoperability..."

"The .NET platform provides parallel execution of code through multithreading. A thread is an independent execution path, able to run simultaneously with other threads. This article describes the fundamentals of .NET threading and how this functionality can be leveraged elegantly by F# programs..."

Introduction to DirectX (31st July 2007)

"The .NET platform contains library interfaces to almost all of the functionality bundled with the Windows platform. Hardware-accelerated graphics are no exception and Managed DirectX (MDX) for .NET provides a high-level and type-safe interface to the DirectX API..."

Exploiting Tail Recursion (16th August 2007)

"Recursion is essential to functional programming and practical use of functional programming languages and a functional style requires the ability to write recursive functions that do not consume stack space. Function calls that require no stack space are called tail calls. This article describes the use of tail calls to write robust and efficient tail recursive functions in F#..."

Combinator Heaven (1st September 2007)

"The ability to write higher-order functions that compose other functions in interesting ways is one of the most powerful forms of abstraction provided by the functional programming paradigm. Such functions are known as combinators . This article describes the basic concepts behind combinators with a variety of examples to demonstrate how practically useful this form of functional abstraction can be..."

A simple FFT implementation (18th September 2007)

"Writing an implementation of the Fourier transform is an excellent lesson in algorithm design and optimization. Moreover, the Fourier transform is one of the most essential tools in numerical computing, with applications ranging from spectral analysis to the multiplication of large integers. This article describes the design and implementation of a simple but efficient FFT..."

Parsing text with Lex and Yacc (30th September 2007)

"The tool stack bundled with the F# distribution includes fslex and fsyacc tools that help in the construction of parsers. The ability to parse data in different formats is often very useful, particularly when translating between representations. This article introduces the concepts of lex and yacc-based parsing and describes how these tools may be used to construct robust and efficient parsers quickly and easily..."

Balanced binary search trees (16th October 2007)

"Functional programming languages like F# excel at handling immutable data structures. In the interests of efficiency, such data structures are typically based upon trees rather than hash tables. Key benefits include the ability to express algorithms elegantly using a declarative style and the inherent thread safety of immutable data structures makes them ideal for concurrent programming. This article describes the design and implementation of a basic balanced binary search tree data structure similar to that of the built-in Set module..."

Optimizing a simple bytecode interpreter (31st October 2007)

"Interpreter and compiler writing is the bread and butter of the ML family of languages and F# is no exception. This article describes the design, implementation and optimization of an interpreter for a simple bytecode language..."

Sequence expressions and comprehensions (16th November 2007)

"The .NET framework provides a powerful generic interface called IEnumerable that allows containers to be treated as arbitrary sequences. The approach is now widely used in C# but F# takes IEnumerable to a new level with its Seq data structure. This article describes abstract sequences in F#, the comprehension syntaxes provided by F# to make their construction simpler and clearer and practical applications of sequences with several examples..."

Parser combinators (30th November 2007)

"Certain applications are extremely well suited to functional programming and parsing is one of them. Specifically, the ability to write functional combinators that allow parsers for everything from integers up to symbolic expressions to be composed is more general and provides more opportunity for code reuse than the use of conventional parser generators such as fslex and fsyacc. This article explains how parser combinators may be designed and implemented in F#, using the standard example of a calculator..."

Quick introduction to web services and databases (20th December 2007)

"The F# programming language combines the expressive power of a modern functional programming language with the comprehensive libraries provided by the .NET framework. This article provides a quick introduction to two of the most widely used aspects of the .NET framework: web services and databases..."

"Modern software is using a wider variety of languages than ever before. The ability to parse and interpret these languages is of growing importance. Fortunately, F# inherits incredibly powerful constructs for parsing and interpreting other languages from its predecessors. This article explains how the power of F# can be harnessed to write a complete term-level interpreter for a programming language in only a tiny amount of F# code..."

Implementing a simple Ray Tracer (16th January 2008)

"Ray tracing is a simple but powerful approach to photorealistic rendering and implementing a ray tracer is an excellent way to learn a programming language and, in particular, to learn about graphics and optimization in the context of numerical algorithms. This article walks through the design and implementation of a basic ray tracer that ray traces a scene in a Windows Forms application that provides the user with rendering options via a menu and real-time incremental update..."

"The benefits of functional programming in certain areas like parsers and compilers are well known but functional programming can also be extremely beneficial in many other areas including numerical computation and technical computing. This articles shows how common functional constructs can be used to implement some numerical methods and even complete working programs much more quickly and easily. The clarity of the resulting implementations is remarkable thanks, in particular, to the use of combinators..."

"The advent of the .NET Framework 3.0 brings an exciting new technology to the Windows platform for the first time: hardware-accelerated vector graphics as part of Windows Presentation Foundation. This part of Microsoft's standard library allows programmers to define resolution-independent vector graphics in the form of arbitrary paths and shapes and visualize them in an interactive GUI. This article describes how these features can be used in F# programs and builds a simple graph plotter as an example..."

Embedding XNA in Windows Forms (29th February 2008)

"Microsoft's XNA library is conventionally used for whole-screen games programming but related GUI applications such as level editors can often benefit from the ability to reuse the same XNA-based rendering code in a Windows Forms application. This article describes how an XNA-based Windows Forms control can be written in F#, allowing XNA to be used in an ordinary Windows application..."

"The F# programming language provides an excellent foundation for technical computing on the Windows platform thanks to its high-performance interactive sessions and integrated support for mathematical types. This article is our first look at numerical libraries, both free and commercial, and describes the implementation quality and easy of use of these libraries in the context of special functions, interpolation and random numbers..."

Reducing development costs with Static Typing (31st March 2008)

"The F# language arms programmers with the most sophisticated static type system of any mainstream programming language. This static type system can be used to remove large classes of common bugs that are otherwise tedious or impossible to track down, drastically reducing software development costs. However, learning how and when to leverage such a type system is an art that requires significant effort to learn. This article describes idiomatic F# style and a variety of techniques that can be used to leverage the static type system in order to catch errors earlier and more easily..."

"This article revisits the subject of numerical libraries for .NET, this time in the context of linear algebra and spectral methods. Specifically, the use and performance of various free and commercial numerical libraries are examined for the computation of eigenvalues and Fourier transforms. This includes a complete 1D FFT interface for F# to the excellent FFTW library..."

Surviving in the multicore era with Microsoft's ParallelFX (30th April 2008)

"As the world transitions to multicore desktop computers over the next few years it is essential that software evolves to take advantage of this new dimension in processing power by exposing parallelism. Any software products that fail to evolve will suffer catastrophic losses in sales. The F# programming language uniquely combines natural parallelism at the language level with state-of-the-art capability at the implementation level thanks to its .NET foundation. Microsoft's new Task Parallel Library (TPL) is the keystone in building parallel F# programs and this article explains how this is done using Microsoft's latest Community Technology Preview (CTP) of the TPL..."

Porting and optimizing the SciMark2 benchmark (15th May 2008)

"The SciMark2 benchmark is a suite of numerical algorithms that were originally collated into a benchmark for scientific computing on the Java platform. Porting this benchmark to F# provides an excellent tutorial on the implementation of efficient numerical algorithms and the existing C# implementation of this benchmark can be used for comparison. The results illustrate the strengths and weaknesses of the current F# implementation in terms of performance..."

Scalable distributed parallelism with MPI.NET (31st May 2008)

"High-performance programs are often run on clusters of machines and the Message Passing Interface (MPI) is the defacto standard for inter-process communication for this kind of distributed parallelism. This article demonstrates just how easily existing .NET libraries can be used to parallelize F# programs across clusters of machines using MPI..."

Real-time Finite Element Materials simulation (15th June 2008)

"Finite Element Materials simulations (FEMs) model a continuous volume of material by breaking it down into a discrete representation with many finite parts. This article describes a simple but fun program that simulates the dynamics of a 2D system of particles and springs in real-time. The program includes an interactive GUI visualization based upon Windows Presentation Foundation..."

"Although the F# programming language offers many improvements over older languages such as unmanaged C, C++ and Fortran the need to interoperate with native code can still arise. The two most important uses for native code interoperability are performance and legacy. This article describes how native code can be invoked from F# programs, including essential design advice for building robust interfaces in this otherwise error-prone task..."

Mathematica interoperability (16th July 2008)

"The Mathematica integrated technical computing environment from Wolfram Research is an incredibly powerful cross platform development environment, language and enormous standard library specifically designed for technical computing. Mathematica's .NET-Link technology is designed to allow Mathematica programs to interoperate with .NET languages such as C#. This article examines the hugely productive marriage of the F# programming language with Mathematica and demonstrates how Mathematica can be controlled entirely from F# programs, allowing Mathematica's awesome functionality to be tapped from a much higher performance and more scalable language..."

Implementing XML-RPC clients and servers (31st July 2008)

"XML-RPC is a protocol for remote procedure calls that is built upon the XML format. Method calls are packaged up by the client as an XML request sent via HTTP to the server whereupon action is taken and a response is packaged up and returned in the same way. This article demonstrates how elegantly F# programs can handle XML data using combinators and describes how a complete client-server pair using XML-RPC can be designed and built from scratch using only a small amount of library code and the .NET framework..."

Language oriented programming: Term Rewriting (16th August 2008)

"An interesting and powerful alternative to the conventional term-level interpreter is called term rewriting. Rather than reducing expressions down to values, term rewriting simply evaluates expressions by performing substitutions and the result of each substitution is another expression. This approach is particularly well suited to computer algebra systems such as Mathematica but is also an underappreciated alternative to dynamically-typed programming languages that can integrate useful features like pattern matching and make techniques like partial specialization far easier. This article describes how a simple term rewriter can be constructed in the F# programming language..."

"The .NET platform represents a radical departure from the previous generation of native-code compiled languages. Whereas languages such as C++ and Fortran have distinct compilation and execution phases, the .NET platform deliberately blurs this distinction with run-time compilation of a distributable platform-independent Common Intermediate Language (CIL). This article examines the use of run-time code generation from F# using the System.Reflection.Emit namespace to implement a compiler for a simple bytecode language..."

Named and Optional arguments (16th September 2008)

"The F# programming language provides a variety of useful features that are not found in many other functional programming languages. This is why F# is widely accepted as a functional language for practical use. Named and optional arguments are two related features that can be used to great effect in simplifying interfaces. This article introduces the syntax required to define and use both named and optional arguments in F# and describes some pedagogical uses of these features, with references to existing libraries, as well as examining some of the problems often encountered by programmers using these features..."

"Web-enabled technology is now ubiquitous and of huge commercial value. These kinds of programs share two common characteristics: they send information over the internet and they perform tasks concurrently. This article is the first in a series to examine the use of the F# programming language in the growing area of concurrent web programming and, in particular, covers the currently-experimental support for asynchronous workflows..."

Triangulated Irregular Networks (TINs) (16th October 2008)

"Adaptive subdivision is a hot topic in computer graphics and forms the foundation of many state-of-the-art algorithms for large scale visualization used for everything from scientific visualization of huge data sets to game graphics that immerse players in expansive virtual worlds. This article describes one of the most popular approaches for the adaptive subdivision of 3D meshes and implements a capable plotting algorithm with real-time visualization using Windows Presentation Foundation showcasing how this simple algorithm works and can be used to solve many different problems..."

Low-level optimization tips and tricks: part 1 (31st October 2008)

"The F# programming language is a fantastic tool for technical computing because it combines easy interactive high-level programming with excellent performance and multicore capability. This makes it feasible to solve a wide variety of problems without having to drop to low-level languages like C for performance. This article describes some of the low-level optimizations that underpin the ability to write performant F# programs by leveraging knowledge about the F# compiler as well as the few situations where F# is currently unable to provide competitive performance..."

Windows Presentation Foundation: basic controls (16th November 2008)

"Microsoft's new Windows Presentation Foundation (WPF) is the next generation of graphical user interface technology, facilitating rich interactive content that is seamlessly integrated with related technologies. This article is the first in a series examining how WPF can be used from the F# programming language. We begin with an overview of WPF and describe the kinds of GUI applications that will benefit the most from using F# before surveying the basic GUI elements provided by WPF..."

Beginner's XNA tutorial (30th November 2008)

"Microsoft's XNA framework is a .NET library intended primarily for games programming that superceded Managed Direct X (MDX). XNA provides a safer, higher-level design that still exposes low-level graphics capabilities in order to provide the best possible performance for graphics-intensive software from a managed language. This article describes everything required to get rendering using the XNA framework with F#, from the most primitive built in effects to custom shader programs..."

Reflection and run-time types (16th December 2008)

"The common language run-time (CLR) provides functionality known as reflection that allows programs to create instances of types dynamically, bind types to existing objects and lookup the type of a given object. The F# programming language maps conventional ML type system constructs (tuples, records and variants) onto .NET classes and augments the reflection capabilities of .NET with functions to interrogate F# types. This article describes the reflection capabilities of F# and provides several example applications demonstrating the use of reflection in F# programs..."

"Finding global minima of an arbitrary function is a significantly more challenging problem than local function minimization and has many practical applications from the simulation of molecules to the design of printed circuit board layouts. Several different global function minimization algorithms exist, many of which make repeated use of local function-minimization algorithms. This article describes a simple and elegant solution to the traveling salesman problem that uses the simulated annealing approach to global function minimization. The results are visualized in real time using Windows Presentation Foundation..."

"Artificial life became a popular topic in the 1980s. In particular, with the discovery that simple rules defining the behaviour of individuals could give rise to sophisticated behaviour of groups of individuals. This unexpected result was described as "emergent behaviour" and one of the most famous examples was a computer program called "Boids" that used only three simple rules to govern the dynamics of individuals but produced remarkably realistic flocking behaviour of the population as a whole. This article describes an interactive boids simulator with a graphical user interface implemented using Windows Presentation Foundation..."

"The F# programming language is a fantastic tool for technical computing because it combines easy interactive high-level programming with excellent performance and multicore capability. This makes it feasible to solve a wide variety of problems without having to drop to low-level languages like C for performance. This article describes garbage collection friendliness, data structure specialization, efficient loops and the use of structs to avoid boxing..."

Working with Regular Expressions (28th February 2009)

"Regular expressions are a domain-specific language for pattern matching over sequences of characters. This functionality provides a concise and efficient way to dissect strings and, consequently, is used in many forms of string processing including the definition of lexers. This article describes how .NET's support for regular expressions can be used to manpulate strings easily and efficiently from the F# programming language..."

Units of Measure (15th March 2009)

"The F# programming language is the first mainstream language in the world to offer statically type checked units of measure. This advanced feature is easy to use and checks the dimensional consistency of programs that manipulate physical quantities. This article introduces units of measure in the F# programming language with the basic constructs, the built-in measures provided with F#, several worked examples of units of measure in action and, finally, a discussion of the caveats of this exciting new language feature..."

Aperiodic Tilings (31st March 2009)

"Many sets of polygons can be used to tile an infinite 2D plane. The term "aperiodic tilings" is used informally to refer to tilings that are not periodic. Such tilings are not only of mathematical and scientific interest because they give rise to unexpected diffraction patterns when they appear in quasicrystalline materials but also because they are often beautiful and, consequently, have been used in ornamental decorations for centuries. This article describes a simple program that visualizes tilings using Windows Presentation Foundation where the tilings are described using generic rewrite rules implemented in terms of a .NET interface..."

"LZW is a simple and effective dictionary-based data compression algorithm originally published in 1984 and subsequently used in several prominent places including the GIF image format. This article describes simple purely functional implementations of the compression and corresponding decompression algorithms before examining the translation and optimization of these algorithms into longer but more efficient imperative equivalents. In particular, F#'s sequence expressions are used extensively to create on-the-fly compressors and decompressors ideal for stream processing..."

"This article is the first in a series describing the design and implementation of some very useful purely functional data structures. Lazy evaluation, lazy streams and batched queues are described in detail. In particular, new .NET interfaces, classes and objects are used factor the implementations of the data structure and various built-in interfaces are implemented in order to support equality, comparison and hashing of these new data structures..."

"This is the second article in a series describing the design and implementation of some purely functional data structures. Real-time queues and catenable lists that provide reliable O(1) time complexity operations are described in detail. In particular, laziness is used to ensure that operations are performed efficiently even when the data structures are used persistently. This culminates in the creation of some useful new data structure implementations..."

"Singular Value Decomposition (SVD) is an important algorithm from linear algebra that decomposes a matrix into the product of three simpler matrices. The resulting decomposition has several applications. This article describes the design and implementation of an F# program that computes the SVD of an image and uses it to create a lossy compression algorithm with controllable quality. This involves numerical methods for computing the eigenvalues of real symmetric matrices and interactive visualization of the result as a standalone Windows Presentation Foundation application..."

Download and play the demo (requires .NET 3.0 or later) or drag the slider below to control the number of singular values used to approximate an image:

Least squares: a case study in optimization (16th June 2009)

"The challenge of finding the least squares best fit of a linear sum of functions is a common problem in regression. Linear algebra provides a powerful and general solution by expressing this problem in terms of matrices and then computing the QR decomposition in order to solve the matrix equation. This article describes a remarkably simple implementation of QR decomposition in F# before developing progressively more optimized implementations using the guidance of performance profiles and without sacrificing generality. In particular, heavy use of the F# keyword "inline" is made in order to express efficient reusable numerical methods..."

F# development with Visual Studio 2008 (30th June 2009)

"The May 2009 Community Technology Preview (CTP) release of F# includes an advanced Visual Studio mode for F# development. This article describes how this may be installed (including the free version of Visual Studio) and used to evaluate F# code interactively and develop F# applications including the generation of standalone .NET executables suitable for redistribution and the static linking of other .NET assemblies (e.g. C# compiled to DLL) as well as new features in the development environment itself..."

2D Scalable Vector Graphics with XNA: part 1 (15th July 2009)

"Vector graphics represent images in terms of lines and curves on a fictional canvas. This resolution-independent representation is ideal for high resolution output devices such as printers but the inevitable march of technology has ossified vector graphics on the desktop as a fundamental component of both Apple's and Microsoft's latest graphical user interfaces. Vector graphics are best represented as trees and manipulated using recursion. Consequently, F# is an extremely powerful tool for writing programs that manipulate vector graphics. This article describes the design and implementation of a simple library for 2D vector graphics written in F# and using XNA for visualization. This would be ideal for games that include 2D graphics with lots of zooming..."

Optimizing the Burrows-Wheeler Transform (31st July 2009)

"The Burrows-Wheeler Transform (BWT) is one of the few preconditioners used in data compression and, in particular, is the core of the popular bzip2 compression utility. This article describes a simple 12-line implementation of the BWT in F# and progressively optimizes the implementation to use a customized quicksort then shared-memory parallelism. On 8 cores, the final optimized implementation is over 1,000× faster than the original..."

Dynamic programming: Levenshtein edit distance (15th August 2009)

"Levenshtein distance is a metric used to measure the amount of difference between a pair of sequences in terms of the number of insertions, deletions and substitutions required to get from one sequence to the other. Computing the Levenshtein distance is an interesting problem in dynamic programming with many practical applications including spell checkers and the study of DNA in bioinformatics. This article describes how the basic algorithm may be implemented and then optimized, including the use of both generic and specialized memoization..."

Traversing networks: the nth-nearest neighbor (31st August 2009)

"Graph theory has a great many practical applications ranging from compiler internals to the study of the structural characteristics of materials. This article describes the design and implementation of a program that finds the nth-nearest neighbors of a given vertex in an infinite graph. This problem is of interest in the context of atomic structures..."

Huffman data compression (15th September 2009)

"Data compression algorithms are not only very useful in practice but are also extremely compelling pragmatic examples of programming theory. The popular Huffman data compression algorithm is from the family of entropy encoding compression algorithms. This article walks through the construction of a simple array-based Huffman compression and decompressor written entirely in F# before converting the functions to handle sequences on-demand in order to provide incremental compression and decompression..."

Visualizing the Fourier Transform (30th September 2009)

"The Fourier transform is one of the most important numerical methods and underpins most forms of spectral analysis. This article describes a simple image compression technique that uses the Fast Fourier Transform (FFT) to remove the high-frequency components of an image. The 2D FFT is efficiently parallelized and the resulting application provides a WPF GUI allowing the user to control the accuracy of the approximation..."

Download and play the demo (requires .NET 3.0 or later) or drag the slider below to see an image approximated by its low-frequency components:

Low-lock algorithms (15th October 2009)

"Locks are the defacto-standard approach to concurrent programming. With locks, shared mutable resources are protected using mutual exclusion to ensure consistency of the shared state from the point of view of different threads. However, locks are slow and, consequently, many situations can benefit from the avoidance of locks in favor of lower-level solutions. Much research has gone into non-blocking (obstruction-free, lock-free and wait-free) algorithms. This article introduces the concepts that underpin the implementation of non-blocking algorithms, including the .NET memory model, and explains how this can be leveraged to avoid locks with the simple example of lazy evaluation..."

Parallelizing the SciMark2 benchmark: part 1 (31st October 2009)

"The SciMark2 benchmark is one of the better benchmarks for programming languages and their implementations in the context of technical computing. This article is the first in a series revisiting the SciMark2 benchmark to examine the potential for parallelizing each of its components. Specifically, the Fast Fourier Transform (FFT) and Successive Over-Relaxation (SOR) tasks are covered in this article. The results are of general interest in the context of improving performance on multicores using parallel programming..."

"Logic programming is a paradigm often seen in problem solving and AI. This article introduces the subject of logic programming and explains why the F# language is ideally suited to these kinds of applications, using the familiar examples of solving the n-queens problem and finding a knights tour. Moreover, the differences between the .NET implementation and those bred specifically for this style of programming is described and techniques that can be used to close the performance gap are discussed..."

"Detailed vector descriptions of worldwide geographical data are freely available in the Shapefile format. This article describes how polygonal data can be parsed from the binary Shapefile format and visualized using Windows Presentation Foundation easily and efficiently using F#. The result is a simple program that can be used as the basis for a wide variety of Geographic Information System (GIS) applications from cartography to climatology..."

Generating and visualizing 2D mazes (15th December 2009)

"Maze generation is a remarkably complex and diverse subject that essentially falls into the category of network or graph theory but is most often seen in the context of games and puzzles. The characteristics that make a maze interesting for humans to try to navigate are subjective and not easily defined and, consequently, the design and implementation of an automatic maze generator is as much an art as it is a science. This article describes the design and implementation of a simple but effective maze generation algorithm including OpenGL-based visualization. The algorithm is elegantly expressed in terms of recursive functions and purely functional data structures..."

Games programming: tic-tac-toe (31st December 2009)

"The game tic-tac-toe, known as Noughts and Crosses in the UK, is one of the simplest popular board games. This article describes an F# program that uses artificial intelligence to provide an infallible computer player, Windows Presentation Foundation to provide a graphical user interface for the desktop and threading to maintain a fluid user experience as the computer thinks about its next move..."

"A common technique to simulate the dynamics of objects is to model them as interacting rigid components. This article describes the design and implementation of a simple F# program that uses rigid body dynamics to simulate balls bouncing around in 2D, using Windows Presentation Foundation for 2D visualization. Dynamics are computed on a worker thread while the GUI thread fetches and visualizes snapshots of the scene..."

"Visualizing a graph or network of interconnected nodes is a fascinating and important challenge with a wide variety of practical applications. This article looks at a simple but effective force-based approach to the visualization of networks and uses Windows Presentation Foundation (WPF) to display the results in real-time as they emerge. The result is a compelling interactive animation of the layout algorithm as it progresses..."

F# development with Visual Studio 2010 and .NET 4 (15th February 2010)

"Microsoft recently released Visual Studio 2010 Release Candidate (RC). The next release will be the official RTM so this is the perfect opportunity to see what improvements have been made to both Visual Studio, The .NET Framework and F# itself. Topics covered include recent changes to the F# language, F# integration in Visual Studio 2010, new functionality bundled in .NET 4 (including numerics and parallelism) and improvements in the CLR itself..."

An introduction to asynchronous workflows (28th February 2010)

"Asynchronous workflows were introduced into the F# programming language in 2007 and have recently matured pending the imminent release of the first officially-supported F# in Visual Studio 2010. This article describes the basic concepts that underpin this language feature and walks through some simple examples that demonstrate both basic and advanced use of this language feature..."

"This article describes the article editing tool we are creating to help automate the process of generating journal content. The editor provides a simple text editor where the author writes a form of markdown. The markdown is interactively parsed and pretty printed in a separate pane and the editor allows the result to be exported to HTML for inclusion in the journal. The application is based entirely upon Windows Presentation Foundation..."

An e-mail client in F# (31st March 2010)

"An e-mail client is an application that checks a remote mailbox for incoming messages and allows the user to send newly composed messages and replies to received messages. Incoming e-mails are typically read using the Post Office Protocol version 3 (POP3) which is a simple plain-text protocol implemented over TCP sockets. Outgoing e-mails are sent using the Simple Message Transfer Protocol (SMTP), an implementation of which is provided by the .NET framework. This article describes the design and implementation of an e-mail client that can be used for basic e-mail handling but, in particular, is easily programmed to perform tasks such as transaction processing automatically..."

The A* algorithm (15th April 2010)

"The A* algorithm is often used for route finding in game AI and is a generalization of Dijkstra's shortest-path algorithm from graph theory. This article describes two generic implementations of the A* algorithm written in F#. The first implementation is a simple prototype written in a purely functional style using data structures provided by F#. The second implementation uses mutable .NET collections to perform the same computation substantially more quickly. Finally, an example application is provided that finds a route across the Grand Canyon..."

Parallelizing the SciMark2 benchmark: part 2 (30th April 2010)

"The SciMark2 benchmark is one of the better benchmarks for programming languages and their implementations in the context of technical computing. This article is the second in a two-part series revisiting the SciMark2 benchmark to examine the parallelization of each of its component tasks. Specifically, the Monte-Carlo, sparse matrix-vector multiplication and LU decomposition tests. The results are of general interest in the context of improving performance on multicores using parallel programming..."

Quicksort (15th May 2010)

"The quicksort algorithm was invented by Tony Hoare in 1960 and remains one of the most celebrated algorithms and is still of great practical value. Implementing some of the many variations of the quicksort algorithm serves as an excellent introduction to mixed-paradigm programming in F# and the implementation of a production-quality implementation benefits enormously from the use of a substantial number of exotic features of the F# language. Moreover, the quicksort algorithm is amenable to parallelization, which is of increasing relevance in the multicore era, so the performance characteristics of parallelizations of the implementations are also of great interest..."

Cache oblivious algorithms: Matrix multiply (31st May 2010)

"The widespread adoption of CPU caches around two decades ago forced a change in the way programmers traverse data structures when performance is of interest. The classic style was to iterate directly using for loops. Two new styles have emerged: either a cache aware set of loops that tile the dataset into fixed-size subsets that fit into a cache of a known size, or a cache oblivious style that uses divide and conquer to subdivide the problem until it fits into the cache regardless its size. This article describes the revolutionary idea of cache oblivious algorithms via the elegant and efficient implementation of a matrix multiply in F#. In particular, we demonstrate the importance of these techniques in the context of multicore programming..."

Parallelism in .NET 4 and Visual F# 2010 (15th June 2010)

"The latest version of the .NET Framework provides a wealth of functionality for parallel programming aimed at multicores. This includes not only the Task Parallel Library, that was previously available in the form of CTP releases, but also Parallel LINQ (PLINQ) and the new concurrent collections. The F# standard library has also been augmented with parallelized functions. This article examines each of these in turn..."

The diff tool (30th June 2010)

"The unix program diff identifies differences between text files, line by line. This tool is most useful for comparing two versions of a program. This article develops a simple implementation of the diff tool based upon the longest common subsequence (LCS) algorithm with a graphical user interface written using Windows Presentation Foundation to visualize the difference between two text files..."

Histogram equalization (15th July 2010)

"Over- and under-exposed images have their intensity distributions skewed to the high or low end of the range. Histogram equilization is one technique to combat this effect digitally by spreading out the distribution of intensities in an image via the intensity histogram. This article describes a program for image enhancement using histogram equalization with an interactive WPF-based GUI using the new charting functionality in .NET 4 to visualize the intensity histograms in real time..."

Data structures: heaps (31st July 2010)

"A min-heap is a tree-based data structure that satisfies the constraint that the children at any given branch are always larger than their parent and, consequently, the minimum element is at the root. Heaps are most notable as an efficient way to implement priority queues which, in turn, underpin a variety of algorithms including some seen in previous F#.NET Journal articles. This article examines skew heaps, leftist heaps, pairing heaps and splay heaps..."

Calculator (15th August 2010)

"The pedagogical calculator sample demonstrates how a program can evaluate mathematical expressions originating from the user interface of a calculator. This article describes the design and implementation of a calculator application that uses Windows Presentation Foundation to provide a graphical user interface similar to that of a traditional calculator. In particular, every effort is made to leverage static checking in order to catch as many bugs at compile time as possible. This includes not only sophisticated union types to represent the state of the state machine but also exhaustiveness and redundancy checking of the advanced pattern matches that result as well as their factoring to reduce code size..."

Simulating predator-prey dynamics (31st August 2010)

"This article describes the design and implementation of a Windows Presentation Foundation application that simulates and visualizes the evolution of the predator and prey populations over time. This involves the numerical integration of a differential equation and the resulting trajectory is visualized as a parametric plot using the new charting and graphing functionality provided with .NET 4. The parameters of the simulation can be adjusted by the user and the graph is updated in real time..."

Distributed message passing (15th September 2010)

"The F# programming language makes message passing easy thanks to union types and pattern matching. Asynchronous workflows leverage this to provide Erlang-style agent-based programming. However, Erlang programs can be distributed across multiple machines transparently but asynchronous workflows work only in-process. This article examines the use of TCP sockets and serialization to communicate values between machines in order to use distributed message passing..."

Representing and searching graphs (30th September 2010)

"Graph theory is an important branch of mathematics in the context of programming because important problems can often be phrased in terms of graphs. This articles takes a look at the representation of graphs in F# and introduces the basic operations of depth-first and breadth-first searches..."

"Following on from our previous article about depth- and breadth-first searches of graphs, this article examines some more involved algorithms that also have many practical applications. A topological sort of a directed acyclic graph produces the vertices in a sequence where every vertex reachable from another appears after it in the sequence. All-pairs shortest paths finds the shortest path from any vertex to any other vertex..."

Concurrent programming: TCP relay server (31st October 2010)

"Asynchronous workflows are an incredibly useful feature of the F# programming language in the context of concurrent programming. This article describes a simple concurrent program that provides a relay server that can be instructed to connect to a TCP server and forward messages to it..."

Computational geometry: quick hull (15th November 2010)

"Computing the convex hull of a set of points is a challenge of fundamental importance in computational geometry. Other tasks such as Delaunay triangulation can be built upon a convex hull algorithm and then tasks such as Ruppert's algorithm may be built upon those. This article describes the design and implementation of the quickhull algorithm in just 10 lines of F# code before going on to build a WPF-based GUI application that can be used to manipulate a convex hull interactively..."

Numerical methods: matrix inversion (30th November 2010)

"Matrix inversion is one of the most important numerical methods with many practical applications. In practice, the numerical instability of matrix inverses leads to the use of linear solvers that effectively premultiply by the inverse of a matrix without having to explicitly compute the matrix inverse. This article disregards numerical accuracy in order to write the simplest possible function that computes the inverse of a matrix. The resulting function is just 8 lines of F# code and the remainder of the article is devoted to examining the generality and parallelization of this tiny function. We find that our tiny solution is up to 4.3× faster than Mathematica 7's built-in matrix inversion..."

Simple and efficient hand-written parsers (15th December 2010)

"In addition to the powerful code generation tools and libraries that assist with parsing, the ability to write simple and efficient parsers by hand can also be extremely useful. This article examines three different kinds of hand-written parsers ranging from very simple and extensible recursive-descent parsers to highly efficient bottom-up parsers..."

Testing: Behaviour-Driven Development with F# (31st December 2010)

"Of the many approaches taken to testing, Behaviour-Driven Development (BDD) is unusual in aiming to provide human-readable tests that can be used by non-technical people. The objective is to write the tests in a high-level language, as close to plain English as possible with data provided in the form of bullet-point lists or tables, that are interpreted by the machine in order to drive a production system and verify its behaviour. Naturally, F# is ideal in this situation because the challenge is essentially to implement an interpreter for a Domain Specific Language (DSL), the task that this family of languages were specifically bred for. This articles walks through a complete sample including Gherkin parser, interpreter and harnesses for the NUnit testing framework and F# interactive..."

Introduction to Silverlight (15th January 2011)

"Microsoft's Silverlight allows .NET programs to be run directly in a compliant browser and all major browsers can support Silverlight. This articles describes how self-contained interactive Silverlight programs can be written entirely in the comfort of the F# programming language an easily to deployed to any web server (not necessarily Windows based) as an easy and efficient way to bring dynamic content to a website..."

Real-time ray tracing in Silverlight (31st January 2011)

"Ray tracing is a simple but powerful approach to photorealistic rendering and implementing a ray tracer is an excellent way to learn a programming language and, in particular, to learn about graphics and optimization in the context of numerical algorithms. This article walks through the design and implementation of a basic ray tracer that visualizes a 3D scene in a Silverlight bitmap and exploits parallelism in order to attain the performance required for real-time animation..."

Sliding averages (15th February 2011)

"Sliding window algorithms are a class of algorithms that treat streams of data by computing a statistic across a window for each position of the window within the data stream. Moving averages are sliding window algorithms that compute an average over each window. This article begins with a simple implementation of the sliding mean average and goes on to examine more efficient algorithms for both mean and median sliding averages..."

Game of Concentration (28th February 2011)

"Concentration is a popular game where the objective is to remember previously-seen cards when flipping over pairs in order to find matching pairs and remove them from the game until none remain. This article describes the design and implementation of a WPF application that implements the game of Concentration. In particular, a novel design is adopted that uses an asynchronous agent to handle user interface timeouts elegantly and a set of mutually recursive asynchronous workflows that implement the state machine of the game logic..."

Graph theory: Strongly-connected components (15th March 2011)

"One of the most important fundamental algorithms in graph theory is Tarjan et al.'s 1972 algorithm for computing the strongly-connected components in a graph in linear time. Strongly-connected components are subgraphs where at least one path exists from any vertex to any other vertex. This has many applications and, in particular, is the basis of many more advanced algorithms from graph theory. This article describes both imperative and purely functional implementations of this algorithm and a WPF-based GUI application that visualizes the strongly connected components of a randomly-generated graph..."

Using MPI over Infiniband from F# (31st March 2011)

"Infiniband is a high-throughput low-latency communication fabric commonly used in supercomputers. This article describes how a standalone F# application can use the Intel MPI 4 library via PInvoke to send and receive messages over an Infiniband connection between two separate machines with latencies as low as 7µs..."

Allocationless programming on .NET (15st April 2011)

"An extreme technique used in some latency-critical applications is to completely circumvent the garbage collector by replacing all heap allocations with the use of pre-allocated arrays of value types, effectively implementing manual memory management inside a managed programming language. This might be called Fortran-style programming on .NET but the advantage is that stalls due to garbage collection can be made less frequent or even eliminated entirely..."

k-means clustering (30th April 2011)

"The k-means clustering algorithm is a simple form of machine learning that categorizes a set of data points into k clusters each centered on its own centroid. This article describes the design and implementation of the k-means clustering algorithm and an example application to a standard Iris flower data set including downloading and massaging the data directly from the web and visualization of the resulting clusters using WPF and the new charting and graping functionality in .NET 4..."

Generic server architecture (15th May 2011)

"Server applications often have very similar requirements in terms of their overall architecture. This article describes the design and implementation of a generic server that allows incoming messages to be validated per-connection, executed centrally, dispatched either to a specific connection or all connections and with all outgoing messages being filtered before they are returned to the client. The result is an elegant fully-asynchronous and generic library for server-side programming that is applicable to a wide variety of real server applications..."

Chat server (30th May 2011)

"Perhaps the simplest complete working example that can be constructed using the generic server architecture described in the previous articles is a chat server that allows clients to logon and communicate by posting messages that are relayed to all other logged-on clients. This article describes a chat server and clients with GUI interface for demonstration..."

Live migration (15th June 2011)

"An interesting application of agent-based programming is the ability to implement virtual agents that are capable of running concrete server applications and then allow the servers to be migrated between agents seamlessly. This article describes the design and implementation of a simple program that demonstrates the effect by allowing a trivial server to be live migrated from one agent to another by instructing the agent to suspend the server, send the server's state to another agent and resume the server's execution at the remote location..."

Symbolic differentiation and matrix inversion (30th June 2011)

"Previous F#.NET Journal articles have covered manipulating symbolic expressions, computing derivatives and inverting matrices. This article combines these concepts in order to build a small computer algebra system capable of symbolically computing and simplifying the inverse of the Hessian matrix and grad of a given expression. This foundation is then used to minimize a symbolic expression to arbitrary-precision using rational arithmetic..."

Caching (15th July 2011)

"Caches are ubiquitous in CPUs themselves but this article takes a look at the kinds of caches that are used in higher-level applications such as distributed web services. Caches with random eviction, round robin and least-recently used (LRU) schemes are examined..."

Symbol tables (31st July 2011)

"Computations such as graph traversals are often most naturally expressed in terms of raw data such as the strings names of the entities involved. This simplicity is valuable but comes at a cost in terms of performance because operations over strings from a finite set are substantially slower than operators over an equivalent representation. Symbol tables offer the ability to replacing strings with ints in order to accelerate computations over them. This article looks at a typical example application that stands to benefit from the use of a symbol table and then demonstrates how a symbol table can be implemented along with an efficient specialized dictionary for keys that are symbols..."

Concurrent change sets (15th August 2011)

"Many applications that perform a series of insertions and removals to and from a set can benefit from the ability to maintain the currently-outstanding added and removed elements such that an external replica of the changing set can be updated in batches on demand. Perhaps the most valuable application is to decouple the performance of a background worker from the user interface thread and vice versa. This article studies a a solution that uses an asynchronous agent sitting between the worker and visualizer that allows the worker to add and remove elements while the visualizer concurrently requests change sets..."

Using sockets from Silverlight (31st August 2011)

"Silverlight applications can communicate with remote servers via TCP sockets. This can be done without requiring elevated permissions (e.g. in browser) provided a client access policy server is running on the remote machine. This article describes how both the client- and server-side solutions to this problem can be written in F#..."

Observables and Reactive Extensions (15th September 2011)

"Various recent additions to the .NET Framework have encouraged event-based programming, including observables and the recent Reactive Extensions (Rx) library. This article reviews the basic properties of observables and some of the core functionality in the Rx library before taking a look at a common problem in event-based programming: subscribing to a state machine..."

Using SQL Server Compact Edition (31st September 2011)

"In addition to the heavy weight SQL Server 2008 and its free sibling SQL Express, Microsoft also offer a light-weight database called SQL Server Compact Edition (CE) that requires fewer resources and, in particular, can be run from a DLL and does not require installation or background services. This article walks through the use of the Northwind database from SQL Server CE including a WPF-based user interface built upon asynchronous message passing..."

Drawing tree maps (15th October 2011)

"A tree map is a simple way to visualize the relative sizes of a collection of objects in 2D. The idea is to recursively subdivide a rectangle into non-overlapping rectangles that have areas proportional to the weights they represent..."

Metaprogramming: parsing with active patterns (31st October 2011)

"Metaprogramming is the art of writing programs that manipulate other programs and includes writing compilers and interpreters as well as more exotic tools such as theorem provers. This article walks through the construction of a mini ML interpreter and, in particular, uses a novel approach to parsing based upon F# active patterns. This allows us to write a lexer and parser for a toy functional language in under 100 lines of vanilla F# code..."

Rendering autostereograms (15th November 2011)

"An autostereogram is a tiling distorted such that the differences between one column of tiles and the next simulate the differences between images seen by the left and right eyes when viewing a 3D scene. This allows a practiced viewer to stare through the picture such that their eyes view the stereogram offset by a single column of tiles and, therefore, they perceive the image to be 3D. This article describes a simple technique that allows autostereograms to be generated by a parallelized F# program..."

Fast Generic Pretty Printing (30th November 2011)

"The ability to convert values into legible strings efficiently, a process known as generic pretty printing, has a variety of uses including debugging and serialization. This article takes a look at the characteristics of the built-in pretty printer before considering alternatives including combinators and reflectors with a view to improving performance. Ultimately, a generic solution is proposed that runs 7,600× faster than the built-in F# solution on our test case..."

Prototyping a mark-sweep garbage collector (15th December 2011)

"Garbage collectors can be notoriously difficult to write. Consequently, the availability of a working simulation can help greatly when trying to write a production-quality garbage collector. This article walks through the design and implementation of a prototype mark-sweep garbage collector. This not only demonstrates that it is possible to prototype low-level tools in F# but also serves as an educational example about garbage collection itself..."

The Very Concurrent Garbage Collector (31st December 2011)

"One of the most interesting research papers on garbage collection describes an unusual algorithm called the "Very Concurrent Garbage Collector" (VCGC) that manages to recycle unreachable heap blocks with only the occasional global synchronization with mutator threads in order to snapshot the global roots. This article walks through the design and implementation of VCGC in F#. Given that the subject of concurrent garbage collectors is notoriously difficult, this demonstrates how prototype solutions written in high-level languages like F# can help with correctness. Furthermore, the implementation adopts an allocationless programming style in order to leverage the benefits of this GC algorithm and we find that maximum pause times are over 100x shorter than with the default .NET 4 workstation GC and wall-clock performance is only slightly worse..."

A vector graphics editor (15th January 2012)

"The combination of asynchronous workflows and union types with pattern matching make F# a powerful tool for GUI programming. This article examines the design and implementation of a simple vector graphics editor written in F# built around the concept of passing messages from the user interface thread to a background worker implementing the application logic..."

Writing a CIL disassembler (31st January 2012)

"The .NET Framework provides powerful reflection capabilities oriented towards compiling run-time generated code to CIL from .NET languages such as F#. In essence, the System.Reflection.Emit namespace provides a programmatic CIL assembler. Relatively little support is provided for the inverse problem of disassembling bytecode back to CIL instructions although this can be very useful for instrumenting assemblies with new code to record code coverage, capture unit tests and measure performance characteristics and so forth. This article walks through the design and implementation of a tiny CIL disassembler that applies the reflection API to itself in order to obtain the required mappings from bytecodes to CIL instructions..."

Efficient structural serialization (15th February 2012)

"The .NET Framework provides binary, JSON and XML serializers. This article takes a look at these built-in serializers before developing a new serializer for values of F# types that addresses some of the shortcomings of the existing serializers including space and time efficiency as well as the ability to save from and reload to structurally equivalent types..."

Compiling to CIL (29th February 2012)

"One of the advantages of the Common-Language Runtime (CLR) is the ability to compile run-time generated code to CIL and have it JIT compiled to native code and evaluated. Regular expressions in .NET are perhaps the most obvious practical application where this capability can pay dividends. This article covers a tiny compiler written in F# that generates and compiles CIL code on-the-fly..."

Drawing trees with WPF (15th March 2012)

"The ability to visualize trees is vitally important in many different applications. This article examines a simple but effective algorithm for visualizing trees and uses WPF to draw the results..."

Writing an x86 JIT compiler (31st March 2012)

"F# comes from the MetaLanguage or ML family of languages that were specifically designed for metaprogramming, a subject that includes writing interpreters, compilers and theorem provers as well as tools that manipulate programs such as refactoring plugins for Visual Studio. This article goes back to F#'s roots to create a tiny JIT compiler capable of transforming high-level expression-based functions down to raw x86 machine code for run-time execution. Remarkably, the resulting compiler is just 170 lines of F# code!"

Visualizing the Stanford Bunny using WPF (15th April 2012)

"Stanford University maintain a database of 3D models, perhaps the most famous of which is the Stanford Bunny. This is a 3D scan of a statue of a rabbit. The tesselated version contains 65,000 triangles and is stored as plain text in a PLY file. This article describes a program that embeds the mesh data as an embedded resource in a .NET assembly, parses it at run-time and visualizes the results in 3D using Windows Presentation Foundation."

Solving Einstein's Riddle (30th April 2012)

"Einstein is said to have posed a logic puzzle, sometimes called the "zebra puzzle", that only 2% of people would be able to solve. This article reviews the puzzle and walks through a simple solver written in F# that finds the correct answer in a fraction of a second."

Hash tries (15th May 2012)

"Purely functional data structures such as the Set and Map collections provided by the F# standard library have many advantages over traditional imperative collections, particularly clarity due to the absence of mutation, but their performance can be much worse. Benchmarks have shown the F# Set and Map running up to 40x slower than the imperative HashSet and Dictionary collections provided by .NET. This article describes the design and implementation of a hash trie implementation of a set that is up to 7x faster to construct and up to 4.5x faster to search than the F# set."

Pathological garbage collector behaviour (31st May 2012)

"When performance is important in a garbage collected language such as F# it is useful to have some understanding of the costs of operations that the garbage collector performs. This article provides an introduction to garbage collection, an overview of the processes performed by generational garbage collectors for multithreaded programs and goes on to examine some F# programs that deliberately exhibit pathological behaviour and presents workarounds that alleviate or even eliminate the costs associated with garbage collection on .NET."

Asynchronous bounded queues (15th June 2012)

"The MailboxProcessor in the F# standard library uses unbounded queues that can grow to be arbitrarily long. Consequently, the queue in a consumer can grow without limit if its producers overwhelm it with data. This article examines an elegant solution to this problem in the form of a bounded queue with asynchronous enqueue and dequeue operations that cause both producers and consumers to cooperatively suspend themselves until capacity or data are available to satisfy their request. Furthermore, this simpler architecture neatly decouples the sequential processes from the concurrent queues they use to communicate."

Cancellable streams (30th June 2012)

"Applications such as searching and visualization that request information from servers often have the potential to overload the server by sending too many requests before the handling of existing requests has been completed. A simple and effective solution to this problem is cancellation. This article examines a simple system of two communicating sequential processes that use cancellation to implement a server that accepts requests, returns responses and uses cancellation to tear down outstanding requests in order to avoid system overload."

Tic-Tac-Toe revisited (15th July 2012)

"This article rearchitects a GUI application from a previous article to use an asynchronous concurrent design. The result is a clean separation between view and model that closely resembles a client-server architecture due to the use of explicit message passing. This design pattern is generally applicable."

Structural typing (31st July 2012)

"Static type systems enforce constraints at compile time by using types as contracts that must be adhered to. Nominal typing compares types according to the explicit interfaces they implement. If two type explicitly implement the same interface then they can be used interchangeably within the context of that interface. Structural typing is an alternative to nominal typing where the comparison of types is based upon the structure of the types rather than explicit interfaces."

Simulating a concurrent system (15th August 2012)

"Distributed concurrency can be complicated and, consequently, there can be great value in having a complete working prototype to study. The simplicity of asynchronous agents in F# makes them ideal for writing simulation code. This article describes the design of a simple concurrent system that distributes incoming messages between two separate concurrent systems in order to duplicate subsequent processing in order to provide fault tolerance."

Numerical integration (31st August 2012)

"Definite integrals can be calculated approximately using a variety of techniques known collectively as numerical integration algorithms. The ability to calculate definite integrals has many practical applications including solving ordinary differential equations. This article describes several basic algorithms for numerical integration and a technique that allows these algorithms to be applied to both finite and infinite limits."

SAT Solver (15th September 2012)

"Satisfiability solvers or SAT solvers are programs than solve logical problems. A boolean SAT solver is one than solves the problem of finding sets of variable bindings for which a given boolean expression evaluates to true."

Basic use of LLVM from F# (30th September 2012)

"The low-level virtual machine (LLVM) is a freely-available high quality code generation library with support for many different architectures and platforms including x86, x64 and ARM. Programs are conveyed to LLVM in its intermediate representation (IR) which is an infinite register virtual machine. LLVM supports both static and JIT compilation of IR to native code. This article describes a compiler written in F# that can compile programs written in a small language to LLVM IR (using PInvoke) in order to evaluate them interactively."

Improving grid performance (15th October 2012)

"Many enterprise software applications require the ability to visualize a grid quickly and easily. This article looks at the performance of using the built-in WPF Grid control for a modest 80x120 grid of numbers and describes the design and implementation of a bespoke FastGrid control that uses WPF's low-level rendering APIs to make startup 16x faster."

Automating deserialization from legacy protocols (31st October 2012)

"Legacy enterprise applications that predate modern web services often communicate using ad-hoc protocols. Such protocols require a lot of tedious and error-prone maintainance due to the unnecessary duplication of essential information. Reflection and metaprogramming provide an opportunity to automate much of the work involved in using such forms of communication provided they are regular, dramatically reducing maintenance costs. This article examines a protocol that uses key-value pairs encoded as lines of text of the form "key=value" and automates deserialization to a more typeful representation, an F# record type."

Structured Grids (15th November 2012)

"Spreadsheets are ubiquitous in business computing but they are a flat unstructured representation of data. Programming languages like F# make it easy to structure data but the ability to convert between flat and structured representations can make it easier to build applications for business users. This article examines the problem of converted structured data into a flat table."

F# on Linux (by Martin Trojer) (30th November 2012)

"The F# software foundation was recently formed to help diversify the F# programming language beyond the Microsoft ecosystem. This article is the first in a series looking at the use of F# on non-Microsoft operating systems, specifically Linux on the desktop and on a Raspberry Pi."

Using F# and WPF to create the World (by Don Ryan) (15th December 2012)

"The great sage and writer, Leo Tolstoy, was fond of applying to various aspects of life a story regarding the Russian painter Briullov who once corrected a student’s sketch by touching it up a little here and there, and the poor, dead sketch suddenly came to life. ‘Why, you just touched it up a little bit, and everything changed,’ said one of the students. ‘Art begins where that little bit begins,’ said Briullov.."

Parallel aggregates (31st December 2012)

"The Array.Parallel module provided by the F# standard library includes parallelized versions of some useful aggregate operators, most notably map. However, this module does not provide the full complement of such operators. This article walks through the design and implementation of many more parallel functions based upon three parallel skeletons (with abstract implementations) including a new mapReduce function."

Editable WPF controls (15th January 2013)

"Editable user interfaces are often clearer if a distinction is made between views used for display and editing. This article describes the design and implementation of a generic editable control that has a concept of validity and several specialized derivative controls that allow different kinds of values to be edited with visual feedback on the validity of their contents."

Editable WPF control for sequences (31st January 2013)

"There are many parallels between types and the built-in WPF controls. An editable boolean can be represented by a check box. An editable enum can be represented by a combobox. An editable string by a text box and so on. Editable sequences are notably absent from the set of built-in WPF controls. This article describes the design and implementation of a WPF control that allows an arbitrary sequence to be edited."

Slackless gears (14th February 2013)

"Computer Aided Design (CAD) has been important in industry for decades but advances in 3D printers for consumers will usher in a new era of CAD software designed for home use over the next few years. This article looks at a simple and elegant design for gears that is particularly well suited to high-precision applications because there is no slack between adjacent gears (provided they have enough teeth)."

Universal reflection (28th February 2013)

"Reflection has many practical applications but is significantly harder using the built-in API that it can be if consideration is restricted to F# types as they are used in messages. This article describes a simple library that allows non-recursive F# types and value of them to be converted to and from an abstract representation in the form of a union type. This makes it much easier to write fast serialization libraries for a variety of different serialized formats."

Creating a Windows Service and using Event Logs (14th March 2013)

"Long running programs such as daemons are conventionally run as services under the Windows operating system. Windows services can be started automatically when a machine boots up. Logging is conventionally accomplished by writing to an Event Log. This article walks through an example windows service that creates and uses its own event log and provides a TCP echo server."

XML Serialization (31st March 2013)

"This article builds upon the recent article about reflecting values of non-recursive F# types in order to create a simple but effective and efficient XML serialization library."

Visualizing transistor characteristics with Arduino with F# (15th April 2013)

"The Arduino is a popular family of hobbyist microcontroller boards. These devices make it easy to connect sensors and actuators to a PC and control them via the serial port using a variety of programming languages including F#. This article shows how a simple circuit can be controlled from F# in order to visualize the properties of a transistor interactively."

Asynchronous Barrier (30th April 2013)

".NET introduced a variety of useful concurrency primitives including the barrier, which blocks a number of threads until they have all reached the same point whereupon the barrier rolls and all of the threads are allowed to progress. This article examines the asynchronous equivalent, a concurrency primitive that provides the same semantics by suspending asynchronous workflows rather than blocking threads."

Generating basic GCode for 3D printers (15th May 2013)

"A variety of consumer-level desktop 3D printers have been released over the past couple of years. Although the hardware is impressive the current generation of software leaves much to be desired, including the CAD, CAM and driver software. This article takes a look at a hollow cylinder printed using the Slic3r CAM software commonly used today and walks through the design and implementation of bespoke CAM software written in F# that produces a much higher quality print in a fraction of the time."

To receive notifications as new articles are published, please subscribe to our F# News blog feed available from this page.