chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] macro systems and chicken (long)


From: Alaric Snell-Pym
Subject: Re: [Chicken-users] macro systems and chicken (long)
Date: Thu, 17 Apr 2008 17:02:23 +0100


On 17 Apr 2008, at 12:58 pm, Alex Shinn wrote:

  (define-syntax let
    (er-macro-transformer
      (lambda (expr rename compare)
        `((lambda ,(map car (cadr expr)) ,@(cddr expr))
          ,@(map cadr (cadr expr))))))

or equivalently with MATCH destructuring

  (define-syntax let
    (er-macro-transformer
      (lambda (expr rename compare)
        (match expr
         ((let ((var val) ...) body ...)
          `((lambda ,var ,@body)
            ,@val))))))

could fail if the (var val) ... list were passed as a syntax
object.  Though probably this would never happen in
practice.

When *will* it happen in practice? I did have the strong impression
that the input to a transformer would always be a normal s-expr. I
know that what make-syntactic-closure or the renaming function return
might be more exotic objects, but I didn't think the input s-expr
could be.

Anyway, regarding DEFINE-RECORD, I've personally been doing
prototyping in Chicken using that and then automatically
converting to DEFINE-RECORD-TYPE, simply for portability
among other Schemes.  You can run the following elisp
function inside the DEFINE-RECORD form to perform the
expansion.

Can we not write a define-record as a macro on top of define-record-
type? I've not used define-record-type much (it seems a bit
overcomplex) so I'm not sure if there's some fundamental
incompatability...

ABS

--
Alaric Snell-Pym
Work: http://www.snell-systems.co.uk/
Play: http://www.snell-pym.org.uk/alaric/
Blog: http://www.snell-pym.org.uk/?author=4






reply via email to

[Prev in Thread] Current Thread [Next in Thread]