Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
80 lines (53 sloc) 2.9 KB
This is a Nu version of the code from Doug Hoyte's excellent book
"Let Over Lambda". The book is focused on harnessing the power of
Lisp macros. If you want to hone your macro-fu, this is a great
book to read. The book uses and builds on many of the ideas in
Paul Graham's book "On Lisp", so it would be helpful to be familiar
with "On Lisp" first.
You can find more information about Doug Hoyte's book at
I didn't try to port any of the Common Lisp reader macros, as Nu
doesn't currently have a reader macro facility.
Also, I didn't use Hoyte's defmacro! enhancement. defmacro! adds two
main features to Common Lisp's defmacro:
1. Ability to use gensyms without first declaring them (g!xxx syntax).
2. Ability to declaratively enforce once-only evaluation of macro
parameters (o!xxx syntax).
Nu's macro facility already has feature 1. And feature 2 is
only a slight amount of syntactic sugar over a let form, so I
just use the lets where needed. I'm sure you get used to seeing
the o!xxx syntax, but I actually like seeing the evaluation steps
of the macro arguments.
There are 3 files of "pure code":
1. - Common Lisp functions that aren't part of Nu.
2. - Macros that wrap NuTestCase. The benefit of
doing this is that you can set the variable
"show-verbose-output" to t in either or in any of your
files, and when you run the test cases, you'll
see the code and output of each assert_equals
3. - Example functions and macros from the book.
There are 2 files that exercise the above code:
1. - examples for the functions and macros in
2. - examples from the functions and macros
You can run all of the test cases in both test_xxx files running "nuke"
("test" is the default target). To make it interesting, set
show-verbose-output to t in so you can see each line of
code that's being tested along with the result.
The test code in the files are in the same order as the
functions and macros in the respective files, so it's pretty
easy to follow along. I usually open up one of the files
in TextMate (with the Nu bundle installed) and Shift-Command-R to run
the unit tests.
This code requires Nu 0.4 or above.
Doug Hoyte wrote the original Common Lisp code to accompany the book.
The code is available at the book's web site.
Jeff Buck ported the code to Nu, added some Common Lisp support functions
that are not already in Nu, and added some enhancements to the utilities.
Jump to Line
Something went wrong with that request. Please try again.