Typed Lazy Lists

Today I’m going to visit two topics that I’ve not covered yet: lazy evaluation and types. Personally, the type system is the hardest thing to get my head around and I hope to write a lot more on the subject. Lazy evaluation allows for the delay of evaluation until a required time. In Shen, lazy evalation is controlled with two functions: freeze and thaw. As the names suggest freeze delays evaluation and thaw evaluates a frozen expression.
Read more →

At the Court of the Nasqueron Dwellers

More Shen macros today. In the previous post I promised an explanation for why we don’t have/need quasiquote, unquote and unquote-splicing in Shen. Let’s look at a Common Lisp example: a single place let. This would typically be written as: (defmacro let-one ((loc val) &rest body) `(let ((,loc ,val)) ,@body)) …using quasiquote, unquote and unquote-splicing. This is actually short hand for the following: (defmacro let-one ((loc val) &rest body) (append (list 'let (list (list loc val))) body)) I think everyone would agree that this second form is harder to read.
Read more →

Alien Algebra

In this post I’m going to concentrate on Shen macros; some familiarity with basic Shen and Common Lisp macros is assumed. In Shen, as in traditional Lisp style, code is data and data is code. Shen code is read in as a list datastructure: (+ 1 2) becomes [+ 1 2]. Shen macros are functions that pattern match on the list representation of code at read time in order to rewrite it.
Read more →