Tuesday, April 25, 2006

macro-happy

I'm still a little too macro-happy these days. Hopefully this phase will pass.


I found a few good references on guidelines for macros:
http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/msg02079.html

I can't end this without not posting my little assert macro

(define-syntax (assert stx)
(syntax-case stx ()
[(_ expr)
(quasisyntax/loc stx
(unless expr
(error 'assert (format "~a lineno ~a: ~s failed"
#,(syntax-source stx)
#,(syntax-line stx)
(quote expr)))))]))

0 Comments:

Post a Comment

<< Home