On Lisp

During my vacation, I skimmed Paul Graham’s book On Lisp. There were many interesting bits in there:

  • He really tries to “sell the wonder of Lisp”. I’m not sure is possible, though.
  • “Users prefer double edged swords to blunt ones”
  • I think that he loves Scheme, but uses CL for practical reasons.
  • He digs deep into code, heavily visiting macros and even implementing continuations, non-determinism, and an object system
  • He is probably a world-class hacker who will never be recognized for his talent, but instead his success
  • This is probably not a good “first Common Lisp book” as it is very deep stuff

Joel Bartlett’s Famous Scheme->C System

Joel Bartlett’s original Scheme->C system has been in stealth mode for some years now, but with a recent re-license under F/OSS terms by HP, the allocation of a web site http://scheme2c.alioth.debian.org/, the integration of all known useful patches including LINUX/i386 and LINUX/amd64 ports, and uploading into the Debian incoming queue, this zippy R4RS Scheme is on the move again!

(via comp.lang.scheme)

An alternate syntax for let

In this post I wondered how one might implement an alternate syntax for let (described in this C.L.L. post), which looks like this:

(let (x 0 y 1 z 2) (+ x y z))

As it turns out my solution was actually let*, and therefore wrong.
Nonetheless, here is wonderful macro provided by Jos that both implements the alternate syntax for let and also demonstrates a technique for how to use the equivalent of “temporary variables” inside of a macro:

(define-syntax my-let
  (syntax-rules ( )
    ((_ my-bindings body-expr0 body-expr ...)
     (my-let-aux my-bindings ( ) body-expr0 body-expr ...))))
(define-syntax my-let-aux
  (syntax-rules ( )
    ((_ ( ) (binding ...) body-expr0 body-expr ...)
     (let (binding ...) body-expr0 body-expr ...))
    ((_ (var value-expr . rest) (binding ...) body-expr0 body-expr ...)
     (my-let-aux rest (binding ... (var value-expr)) body-expr0 body-expr ...))))
(my-let (x 1 y 2 z 3)
        (+ x y z))