Alan Post scripsit: > I've been watching the progress on the hygenic branch, but I haven't > been worried about porting code until now. I tend to use macros > here and there, but almost always in very simple #define-like uses: > > (define-macro (char->number ch) > `(- (char->integer ,ch) > (char->integer #\0))) > > (define-macro (0= n) > `(= 0 ,n))
Note that as written, these will not work properly if - or char->integer or = have been redefined at the point of use: you'll get the local definitions rather than the global definitions you expect. (This isn't as much of an issue in Common Lisp, where redefinition of standard functions is not allowed, and variable names and function names are in separate namespaces.) On the other hand, it's trivial to rewrite these using syntax-rules, thus: (define-syntax char->number (syntax-rules () ((char->number ch) (- (char->integer ch) (char->integer #\0))))) (define-syntax 0= (syntax-rules () ((=0 n) (= 0 n)))) For more explanations of syntax-rules, read the excellent "JRM's Syntax-rules Primer for the Merely Eccentric" at http://www.xs4all.nl/~hipster/lib/scheme/gauche/define-syntax-primer.txt . But on the gripping hand, defining little things like this as procedures rather than macros is not likely to cost you very much. Premature optimization is the root of all evil. -- John Cowan [EMAIL PROTECTED] http://www.ccil.org/~cowan O beautiful for patriot's dream that sees beyond the years Thine alabaster cities gleam undimmed by human tears! America! America! God mend thine every flaw, Confirm thy soul in self-control, thy liberty in law! --one of the verses not usually taught in U.S. schools _______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users