Newsgroups: comp.lang.scheme
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!udel!princeton!news.princeton.edu!blume
From: blume@atomic.cs.princeton.edu (Matthias Blume)
Subject: Re: macros
In-Reply-To: d94-cge@vibrators.nada.kth.se's message of 27 Jan 1995 16:39:09 GMT
Message-ID: <BLUME.95Jan27141202@atomic.cs.princeton.edu>
Originator: news@hedgehog.Princeton.EDU
Sender: news@Princeton.EDU (USENET News System)
Nntp-Posting-Host: atomic.cs.princeton.edu
Organization: Princeton University
References: <D94-CGE.95Jan27173909@vibrators.nada.kth.se>
Date: Fri, 27 Jan 1995 19:12:02 GMT
Lines: 22

FIn article <D94-CGE.95Jan27173909@vibrators.nada.kth.se> d94-cge@vibrators.nada.kth.se (Christer Gessler) writes:

 
   Could someone give me a simple example of using macros?
   What I want to do is this:  I have a monitor procedure
   that takes two arguments, the procedure to monitor and
   its symbol (name) (so I can output what procedure I'm
   handling to the user).
   But to avoid having to type
   (proc-monitor proc 'proc)
   I'd like a macro that expands
   (proc-monitor proc)
   to the above before evaluation.

(define proc-monitor-fun proc-monitor)

(define-syntax proc-monitor
  (syntax-rules ()
    ((_ var) (proc-monitor-fun var 'var))))

--
-Matthias
