-
How to write a Lisp evaluator in Haskell
I promised my students last semster that I’d show how to write (some of) a Lisp in Haskell, in order to demonstrate the usefulness of algebraic data types for prototyping structured applications – and also for fun, obviously. Source code for everything in this post can be found here.
This short tutorial is targeted at Haskell beginners, and doesn’t even use a single monad, unlike more popular and full-featured tutorials like write yourself a scheme and write you a haskell. I achieve brevity and simplicity in the following way:
-
Only implementing the “EPL” part of the REPL, because parsing is Boring.
-
Not implementing macros.
-
Cutting lots of corners.
Ready? Let’s begin.
[Read more...] -
-
Elementary constructive analysis in Haskell
What is a number?
The question is deceptively simple, but your answer – and seriously, do try to answer it – has important implications for how you think about mathematics. For example, an archetypal constructive mathematician would argue that there are two kinds of numbers: those that can be finitely constructed, and those that can be approximated arbitrarily well (and, moreover, nothing else!).
In this post we’ll see how such a mathematician would define different sets of numbers, and formalize all of them with Haskell’s beautiful algebraic data types.
[Read more...] -
A taste of distributed computing
The following is a transcript of a talk I gave at the 2016 UTG Lightning Talks at U of T, along with some references and notes. Leave clarifying questions in the comments section!
[Read more...] -
Python-flavored Lisp
I mentioned in lab this week that a sufficiently crazy person could write a programming language with Lisp semantics and Python syntax. I found this idea useful when I was learning, so I want to expand upon it here by making a rudimentary evaluator for such a language. But let’s first explore the premise.
[Read more...]
subscribe via RSS