Tag Archives: F#

Writing your own arithmetic language in F#.

During a programming languages course, we were asked to write an arithmetic language. The exercise was meant to teach some fundamental ideas regarding what a programming language is. So without further delay, here is the result of my first arithmetic language. type AE = | Num of int | Sum of AE * AE   [...]

Posted in Programming | Also tagged , | Leave a comment

Currying in F#.

Currying is a powerful programming technique that allows you to apply parameters to a function, even if you don’t have all of the parameters quite yet! This example is written in F#. Lets start with a simple example. let curry f a = f a let adder = (curry (fun x -> x + 1)) [...]

Posted in Programming | Also tagged , | Leave a comment

Mapping in F#.

This is a very simple example that illustrates the the ‘map’ concept used in functional programming. This example is written in F#. Mapping is a popular programming concept that lets you apply a function to each element of a list or collection. The return value of a map operation is another list. Because the same [...]

Posted in Programming | Also tagged , | Leave a comment