Tag Archives: functional programming

Applying functions to arguments in Python.

One of my favorite features of functional programming languages is that you can treat functions like values. You can assign them like any other value, but most interestingly you can apply them! Though Python requires that you use a special notation to do so, I wanted to write this down so that it is clear [...]

Posted in Programming | Also tagged | Leave a comment

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