Tag Archives: functional programming

Using reduce in Python.

Python has a built in operator called reduce. This is just another name for what a functional programmer would called a fold. They’re really useful, but you don’t know so until you actually need one. The easiest example to understand is listed below and is the same example provided on Python’s documentation. lon = [1, [...]
Posted in Programming | Also tagged , | Leave a comment

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