chicken-users
[Top][All Lists]
Advanced

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

enhanced procedural-macros egg


From: Juergen Lorenz
Subject: enhanced procedural-macros egg
Date: Sat, 2 May 2020 13:03:39 +0200

Hi all,

hope, you are all well despite Corona.

I have just uploaded version 3.0 of my procedural-macros egg, which
offers two new macros, define-er-macro and define-ir-macro.
Both do destructuring and keyword-checks with an improved version of
bind-case from my bindings egg and automatically do renaming and
injecting by means of one additional argument, a prefix, a one letter
symbol most of the time.

A simple example, a verbose variant of if, might clarify matters:

  (define-er-macro (vif test (then . xprs) (else . yprs)
    (where (key? then) (key? else)
    %
    `(,%if ,test (,%begin ,@xprs) (,%begin ,@yprs)))))

This will expand into

  (##core#define-syntax
    vif
    (er-macro-transformer342
      (lambda338
        (form334 rename335 compare?337)
        (bind-case340
          form334
          ((_324 test (then . xprs) (else . yprs))
           (where326
             (compare?337 then (rename335 'then))
             (compare?337 else (rename335 'else)))
           (let339
             ((%begin (rename335 'begin)) (%if (rename335 'if)))
             `(,%if ,test (,%begin ,@xprs) (,%begin ,@yprs))))))))

Maybe, these two new macros, as well as the others from this egg, might
interest you.

Cheers

Juergen

-- 

Dr. Juergen Lorenz
Gruener Weg 27
29471 Gartow

Attachment: signature.asc
Description: PGP signature


reply via email to

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