Re: Four problems with Scheme 48 1.8
Taylor R Campbell <[email protected]>
| Newsgroups | gmane.lisp.scheme.scheme48 |
|---|---|
| Message-ID | <[email protected]> |
Date: Wed, 15 Jul 2009 11:40:24 +0200 From: Martin Ward <[email protected]> I was hoping that there would be a simple way to define defmacro using define-syntax and syntax-rules, but I can't find one. (There is something which lookd promising in SLIB, but I couldn't get it to work). DEFMACRO is a bug. Some Schemes attempt to mask the bug by providing DEFMACRO, but fortunately for you Scheme48 doesn't do that. Anyway, why write a macro? Your macro -- as defined -- exhibits a property that is at least confusing and that one might consider to be a bug: (SUBSTR <string> <from> <count>) evaluates the expression <from> twice. Aside from that, though, SUBSTR macro does nothing that a procedure couldn't do: (define (substr string from . count) (substring string from (if (pair? count) (+ from (car count)) (string-length string))))