This is the mail archive of the cgen@sources.redhat.com mailing list for the CGEN project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Recursive expansion of pmacros (was: Re: Typo: .substr in pmacros.texi is .substring in pmacros.scm)


> From: Doug Evans <dje@transmeta.com>
> Date: Tue, 19 Mar 2002 12:24:36 -0800 (PST)
> Cc: cgen@sources.redhat.com

> Hans-Peter Nilsson writes:
>  > As I wrote, I had already startet to depend upon it in a port in
>  > progress.  I greatly simplified things (or made it hard in the
>  > absence, I should say).
> 
> Note that there are otherways to do this, besides the implicit re-lookup.

I'm totally blank (what "this"?)  I generally want to map a
pmacro on a list defined as a pmacro, generating calls to other
pmacros.  How can I do that without re-lookup?

(define-pmacro x (a b c))
(define-pmacro (do-a y) (+ y 1))
(define-pmacro (do-b y) (- y 1))
(define-pmacro '(do-c y) (* y 2))
(pmacro-expand '(.map (.pmacro (z) ((.sym code- z) ((.sym do- z) w))) x))
=> ((code-a (+ w 1)) (code-b (- w 1)) (code-c (* w 2)))

Hmm, maybe that didn't come out clear.  Tell me if you feel you
need something better.

brgds, H-P


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]