At this half-way stage of the course, Jeremy will record a short feedback video that reviews the first three weeks, to address some of your comments and questions. The video …
Once upon a time, there was a mathematician named Alonzo Church at Princeton University. Church was Alan Turing’s PhD supervisor. Church devised a mathematical model of functions called lambda calculus. …
Inevitably, we have glossed over some of the more complex parts of Haskell while we have been introducing the language. Now it’s time to explore one of the ideas we …
In Computer Science, trees grow upside-down. The unique root is at the top, and the leaves are at the bottom. The binary tree data type is often used for storing …
So far we have looked at the basic built-in data types like Int and Boolean. We can combine these basic types to generate custom data types, using algebraic sums and …
The basic mechanism for computing on any datastructure in Haskell is recursion. Recursion always has a base case and an induction case. For lists, the base case is the empty …
This tutorial explains the relationship between the higher-order list operations map, foldl and foldr and loops in an imperative language. The source code can be found on GitHub Summary map …
Computing with lists There are two approaches to working with lists: Write functions to do what you want, using recursive definitions that traverse the list structure. Write combinations of the …
We are going to write a moderately long Haskell program, consisting of multiple functions and I/O actions. Guessing Game The program is going to be a guessing game, called Starman. …
We used the online Haskell interpreter (tryhaskell) for the first few programming exercises. Now we want to move to GHCi, for some larger and more complex Haskell development.
GHC stands for the ‘Glasgow Haskell Compiler’. This is actually a set of components that allow you to execute Haskell programs on your local machine. GHC works on Windows, Mac …
Pure Functions So far, we have concentrated on pure functions. These kinds of functions take values as arguments, do some processing of those values, then return a result value. A …
Computers interact with the outside world via input and output (I/O). The Haskell programming language has specific support for I/O operations, which we will explore in the next few steps.
The zip function is used to combine a pair of lists into a list of pairs. Since lists are such fundamental data structures in functional programming, it’s important to be …