[Top][All Lists]

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

Re: [Chicken-users] Defining defmacro using define-syntax

From: Peter Bex
Subject: Re: [Chicken-users] Defining defmacro using define-syntax
Date: Mon, 13 May 2019 20:35:05 +0200
User-agent: NeoMutt/20170113 (1.7.2)

On Mon, May 13, 2019 at 07:11:40PM +0100, Martin Ward wrote:
> Chicken scheme does not appear to have defmacro or define-macro
> but does have define-syntax.
> Is there a way to define defmacro using define-syntax?

This is of course highly discouraged (because defmacro is
inherently unhygienic), but you can do:

(import (chicken syntax))

(define-syntax defmacro
  (syntax-rules ()
    ((_ ?name ?args ?body ...) 
     (define-syntax ?name
         (lambda (e r c)
           (apply (lambda ?args ?body ...) (cdr e))))))))


Attachment: signature.asc
Description: PGP signature

reply via email to

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