2 Mar 2004 bmastenbrook   » (Master)

As a quick follow up to my post of yesterday, I've updated my common-idioms package to contain 100% MORE EVIL. Included are two symbol property-list abusing macros, one of which depends on order of expansion and is thus technically not ANSI.

The first of these macros is symbolic IF, which works as follows:

(let ((x (list 1 2 3)))
  (sif (cdr x)
       (sif (car it)
            (setf it 'foo))) x) => (1 foo 3)

The second is let-env, which is the unportable one I mentioned:

(let ((x 1)
      (y 2))
  (let-env env
           (append
            (let ((x 3)
                  (y 4))
              (setf x 5)
              (env (x)
                   (setf x 6)
                   (setf y 7))
              (list x y)) (list x y)))) => (5 7 6 2)
Also, the completely unportable but highly useful EXPAND-ONLY has been extended to allow expanding of all macros (pass T for the name list) and to return a second value containing an alist of (form expansion) pairs for forms that couldn't be found in the current expansion (happens often with SETF).

If you're interested, head over to CLiki and check it out.

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!