From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Israelsson Tampe Newsgroups: gmane.lisp.guile.user Subject: Re: eval-when not giving me what I hoped for Date: Thu, 11 Feb 2016 11:09:44 +0100 Message-ID: References: <45FAD965-ED1F-434A-9A1E-A17E2ED8E04D@verizon.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113ead28f4db0a052b7bbfa8 X-Trace: ger.gmane.org 1455185400 30042 80.91.229.3 (11 Feb 2016 10:10:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 11 Feb 2016 10:10:00 +0000 (UTC) Cc: "guile-user@gnu.org" To: Matt Wette Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Feb 11 11:10:00 2016 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aToCE-0006O3-Mr for guile-user@m.gmane.org; Thu, 11 Feb 2016 11:09:59 +0100 Original-Received: from localhost ([::1]:48315 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aToCE-0001dG-5D for guile-user@m.gmane.org; Thu, 11 Feb 2016 05:09:58 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50014) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aToC3-0001c5-Rx for guile-user@gnu.org; Thu, 11 Feb 2016 05:09:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aToC1-0004Lt-Vx for guile-user@gnu.org; Thu, 11 Feb 2016 05:09:47 -0500 Original-Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]:37505) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aToC1-0004Li-HX for guile-user@gnu.org; Thu, 11 Feb 2016 05:09:45 -0500 Original-Received: by mail-wm0-x235.google.com with SMTP id g62so61791042wme.0 for ; Thu, 11 Feb 2016 02:09:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=D+tTVWcR9anHLOHRRPU3gBYRgudA4KQczOsQOWT6uN4=; b=G+wyW04M/xIJdcpBaGznCBNuZxd3vzEvg451df6BMh4W2Un0fAp+WuK5fj0Mxh6o29 NnduCNL8ib8+WpMNWzsd4dvwuuCBhpJW7pESWnr3YN0OAlit2wTg8rDZHa5NH8HOCT1G ZT2hwzhJ4K1DeBLiOaV3rs739YFBmHCzwZXGA6nxtZ1T6g2u+iYvju5ox+ghZ7hPZ/1T 9IgErJeIsGGtAEFbheMkqlya6CPq+gUjt0I+9OlqzPgSpjdfxarahGAE/reBLfbiqbDD idqDzDtTpD6BclvPv7V42eJfBYEzGZ/FfnzbEkTRElkoUrASnNqUlMjRX3hvvObFNs4N BxKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=D+tTVWcR9anHLOHRRPU3gBYRgudA4KQczOsQOWT6uN4=; b=P1Ja4aP+jh0A2eVaxFrjXQBniLzsQYeX9wo+i2ofqXzy8iWhRBEHRmbovyj4axfDhR ztbP4XFHajT7yvnD7qFX0+rny/UIS3F4tUwhuhiZHZ/HTyYY4YiX4StZnixWNOEcpGcJ zRXoW4OyFX8bHQWIdvmnSv6REHKOZoFHrGZqb39HREUiEbCZxE5ZkSXZ1aLXTwVpHwPu QZj/XR91T5E4l46U8/QyMUdHhWsSiIOHe5PSlq4QewWeeP+P1mjKeFGN4MBbJegIx/9P +8vdOJ9/0X7iYteNHnF/Ox/kdeTO2zTe6ZyAxd7yvHb/6omLHuLmo75voTHgy77PQoSS qHzg== X-Gm-Message-State: AG10YORaCGK0w9MEIQXxuyktkFSe/8eDB6D5nrOHs6J3qQlM9FIAi/vv5GWLsYfmhn9wdQj2JaQ2YKfy/hzasg== X-Received: by 10.28.35.14 with SMTP id j14mr17201046wmj.80.1455185384998; Thu, 11 Feb 2016 02:09:44 -0800 (PST) Original-Received: by 10.27.187.196 with HTTP; Thu, 11 Feb 2016 02:09:44 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::235 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:12391 Archived-At: --001a113ead28f4db0a052b7bbfa8 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Stupid email client, ... one more try Actually, it would have been nice to have something like (prepend-toplevel-form syntax) Because then you could have done somthing like (define-syntax rx (lambda (x) (syntax-case x () ((_ pat) (with-syntax (((nm) (generate-temporaries (list #'pat)))) (prepend-toplevel-form #'(define nm (make-regexp pat))= ) #'nm))))) and use it as previous mail On Thu, Feb 11, 2016 at 11:08 AM, Stefan Israelsson Tampe < stefan.itampe@gmail.com> wrote: > Actually, it would have been nice to have something like > > (prepend-toplevel-form syntax) > > > Because then you could have done somthing like > > (define-syntax rx > (lambda (x) > (syntax-case x () > ((_ pat) > (with-syntax (((nm) (generate-temporaries (list #'pat)))) > (prepend-toplevel-form #'(define nm (make-regexp > pat))) > > #'(let ((val (hash-ref defined 'nm err))) > (if (eq? val err) > (let ((val (make-regexp pat))) > (hash-set! defined 'nm val) > val) > val)))))))) > > > > On Thu, Feb 11, 2016 at 10:37 AM, Stefan Israelsson Tampe < > stefan.itampe@gmail.com> wrote: > >> the result of eval-when will be available only att specified phases. So >> your eval-when code will not be available >> except at expansion. Also it looks like you want to precompile the >> regexes. This is not a stupid idea and should >> be done at load time because regexp literals is not supported by guile >> scheme. >> >> I'm not sure what the best way to implement this is but why not memoize >> the value of the regexp like in >> >> (define err (cons 'not 'defined) >> (define defined (make-hash-table)) >> (define-syntax rx >> (lambda (x) >> (syntax-case x () >> ((_ pat) >> (with-syntax (((nm) (generate-temporaries (list #'pat)))= ) >> #'(let ((val (hash-ref defined 'nm err))) >> (if (eq? val err) >> (let ((val (make-regexp pat))) >> (hash-set! defined 'nm val) >> val) >> val)))))))) >> >> use it as >> >> #'(let ((id (rx pat)) ...) >> (cond >> ((regexp-exec id str) =3D> >> (lambda (m) (rx-let m (v ...) exp ...))) >> ... >> (else else-exp ...))))) >> >> Ideally you should be able to generate the regexp at loading as you want >> to do but I don't think it is supported. >> >> Regards >> Stefan >> >> >> On Thu, Feb 11, 2016 at 5:28 AM, Matt Wette >> wrote: >> >>> I am trying to get a macro to expand at compile time using eval-when, >>> but it=E2=80=99s not giving me what I expect: >>> >>> (eval-when (expand) (make-regexp pat)) =E2=80=A6 >>> >>> gets expanded to: >>> >>> (if #f #f) >>> >>> I would like to see something like >>> >>> # >>> >>> Any help would be appreciated. =E2=80=94 Matt >>> >>> I get the same (if #f #f) result whether I use (expand) or (compile). >>> >>> Below is >>> 1) my macro (missing the helpers all-const-string? and rx-let) >>> 2) the macro I use to compile to il-tree and then back to scheme >>> 3) the demo code >>> 4) the output from expand >>> >>> =3D=3D=3D my macro =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D >>> (define-syntax regexp-case >>> (lambda (x) >>> (syntax-case x (else) >>> ((_ str ((pat v ...) exp ...) ... (else else-exp ...)) >>> (with-syntax (((id ...) (generate-temporaries #'(pat ...)))) >>> (all-const-string? #'(pat ...)) >>> #'(let ((id (eval-when (expand) (make-regexp pat))) ...) >>> (cond >>> ((regexp-exec id str) =3D> >>> (lambda (m) (rx-let m (v ...) exp ...))) >>> ... >>> (else else-exp ...))))) >>> ((_ str ((pat v ...) exp ...) ...) >>> (with-syntax (((id ...) (generate-temporaries #'(pat ...)))) >>> (all-const-string? #'(pat ...)) >>> #'(let ((id (eval-when (expand) (make-regexp pat))) ...) >>> (cond >>> ((regexp-exec id str) =3D> >>> (lambda (m) (rx-let m (v ...) exp ...))) >>> ... >>> (else >>> (scm-error #f "regexp-case" >>> "no match found: ~S" (list str) >>> #f))))))))) >>> >>> =3D=3D=3D the expand macro =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D >>> >>> #:use-module (srfi srfi-11) >>> >>> #:use-module (system base compile) >>> >>> >>> (define* (expand-form e #:key (opts '())) >>> >>> (let-values (((exp env) (decompile >>> >>> (compile e #:from 'scheme >>> >>> #:to 'tree-il >>> >>> #:env (current-module)) >>> >>> #:from 'tree-il >>> >>> #:to 'scheme >>> >>> #:opts opts))) >>> >>> exp)) >>> >>> >>> (define-syntax-rule (expand _expression_) >>> >>> (expand-form '_expression_)) >>> >>> =3D=3D=3D orig test case =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D >>> (regexp-case str >>> (("^([a-z]+)\\(([0-9]+)\\)$" v i) >>> (list v i)) >>> (("^([a-z]+)$" v) >>> (list v "1"))) >>> >>> =3D=3D=3D output from expand =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>> >>> (let ((t-768 (if #f #f)) >>> >>> (t-769 (if #f #f))) >>> >>> (let ((t (regexp-exec t-768 str))) >>> >>> (if t >>> >>> (let ((m t)) >>> >>> (let ((v (match:substring m 1)) >>> >>> (i (match:substring m 2))) >>> >>> (list v i))) >>> >>> (let ((t (regexp-exec t-769 str))) >>> >>> (if t >>> >>> (let* ((m t) (v (match:substring m 1))) >>> >>> (list v "1")) >>> >>> (scm-error >>> >>> #f >>> >>> "regexp-case" >>> >>> "no match found: ~S" >>> >>> (list str) >>> >>> #f)))))) >>> >>> >> > --001a113ead28f4db0a052b7bbfa8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Stupid email client,= ... one more try

Actually, it would have been nic= e to have something like=C2=A0

=C2=A0 =C2=A0 (prepend-toplevel-form sy= ntax)


Because then you could = have done somthing like

(define-syntax rx
=C2=A0 =C2=A0 = =C2=A0(lambda (x)
=C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 (syntax-case x ()
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ((_ pat)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (w= ith-syntax (((nm) (generate-temporaries (list #'pat))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(prepend-toplevel-form #'(define nm (mak= e-regexp pat)))
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#'nm)))))
<= div style=3D"font-size:12.8px">
an= d use it as previous mail

<= div class=3D"gmail_quote">On Thu, Feb 11, 2016 at 11:08 AM, Stefan Israelss= on Tampe <stefan.itampe@gmail.com> wrote:
Actually, it would have been nice to= have something like=C2=A0

=C2=A0 =C2=A0 (prepend-toplev= el-form syntax)


Because then you co= uld have done somthing like

(define-syntax rx
=C2=A0 =C2=A0 =C2=A0(lambda (x)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (syntax-case x ()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ((_ pat)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 (with-syntax (((nm) (generate-temporaries (list #'pat= ))))
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(prepend-toplevel-form = #'(define nm (make-regexp pat)))

=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#'(let ((val= (hash-ref defined 'nm err)))
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(if (eq? val err)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (let ((val (make-regex= p pat)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (hash-set! defined 'nm val)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0val)
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0val))))))))



On Thu, F= eb 11, 2016 at 10:37 AM, Stefan Israelsson Tampe <stefan.itampe@gmai= l.com> wrote:
the result of eval-when will be available only att specified phases. So= your eval-when code will not be available
except at expansion. Also it= looks like you want to precompile the regexes. This is not a stupid idea a= nd should
be done at load time because regexp literals is not sup= ported by guile scheme.

I'm not sure what the = best way to implement this is but why not memoize the value of the regexp l= ike in

(define err =C2=A0 =C2=A0 =C2=A0 =C2=A0 (co= ns 'not 'defined)
(define defined (make-hash-table))
(define-syntax rx
=C2=A0 =C2=A0 =C2=A0(lambda (x)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (syntax-case x ()
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ((_ pat)
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (with-syntax (((nm) (generate-tempor= aries (list #'pat))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#'(let ((val (hash-ref defined &#= 39;nm err)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if (eq? val err)
=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (let ((val (make-regexp pa= t)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 (hash-set! defined 'nm val)
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0val)
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0val))))))))

use it as

#'(let ((id (rx pat)) ...)
=C2=A0 =C2=A0 =C2=A0(cond
=C2=A0 ((regexp-exec id str) =3D>
(lambda (m) (rx-let m (v ...) exp ...)))
...
<= font face=3D"Courier New">=C2=A0 = (else else-exp ...)))))

Ideally you should = be able to generate the regexp at loading as you want to do but I don't= think it is supported.

Regards
Stefan

=

On Thu,= Feb 11, 2016 at 5:28 AM, Matt Wette <matthew.wette@verizon.net> wrote:
I am trying to get a macro to exp= and at compile time using eval-when, but it=E2=80=99s not giving me what I = expect:

(eval-when= (expand) (make-regexp pat)) =E2=80=A6

gets expanded to:<= /font>

=C2=A0 =C2=A0 =C2=A0 =C2=A0 (if #f #f)
<= font face=3D"Courier New">
= I would like to see something like=C2=A0

#<regexp 109= 8a2d40>

Any help would be appreciated.=C2=A0=E2=80= =94 Matt

I = get the same (if #f #f) result whether I use (expand) or (compile).

Below is=C2=A0
1) = my macro (missing the helpers all-const-string? and rx-let)
2) the macro I use to compile to il-tree and t= hen back to scheme=C2=A0
3) the demo code=C2=A0
4) the output from expand

=3D=3D=3D my macro = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D
(define-syntax regexp-= case
=C2=A0 (lambda (x)<= /div>
=C2=A0 =C2=A0 (syntax-case x (else)
=C2=A0 =C2=A0 =C2=A0 ((_ str ((pa= t v ...) exp ...) ... (else else-exp ...))
=C2=A0 =C2=A0 =C2=A0 =C2=A0(with-syntax (((id ...) (generate-te= mporaries #'(pat ...))))
(all-const-string? #'(pat .= ..))
#'(let ((id (eval-when (expand) (make-regexp pat)))= ...)
=C2=A0 =C2=A0 (cond
=C2=A0 =C2=A0 =C2= =A0((regexp-exec id str) =3D>
=C2=A0 =C2=A0 =C2=A0 (lambd= a (m) (rx-let m (v ...) exp ...)))
=C2=A0 =C2=A0 =C2=A0...
=C2=A0 =C2=A0 =C2=A0(else else-exp ...)))))
= =C2=A0 =C2=A0 =C2=A0 ((_ str ((pat v ...) exp ..= .) ...)
=C2=A0 =C2=A0 =C2=A0 = =C2=A0(with-syntax (((id ...) (generate-temporaries #'(pat ...))))
(all-const-string? #'(pat ...))
#'(let (= (id (eval-when (expand) (make-regexp pat))) ...)
=C2=A0 =C2= =A0 (cond
=C2=A0 =C2=A0 =C2=A0((regexp-exec id str) =3D><= /font>
=C2=A0 =C2=A0 =C2=A0 (lambda (m) (rx-let m (v ...) exp ...))= )
=C2=A0 =C2=A0 =C2=A0...
=C2=A0 =C2=A0 =C2= =A0(else
=C2=A0 =C2=A0 =C2=A0 (scm-error #f "regexp-cas= e"
=C2=A0"no match found: ~S" (list str)
=C2=A0#f)))))))))

=3D=3D=3D the expa= nd macro =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D

#:use-module (srfi srfi-11)

#:use-mod= ule (system base compile)


(define* = (expand-form e #:key (opts '()))

=C2=A0 (l= et-values (((exp env) (decompile

=C2=A0=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 (compile e #:from 'scheme

=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 #:to 'tree-il

=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 #:env (current-module))

=C2=A0=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 #:from 'tree-il

=C2=A0=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 #:to 'scheme

=C2=A0=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 #:opts opts)))

=C2=A0 = =C2=A0 exp))


(define-s= yntax-rule (expand _expression_)

=C2=A0 (e= xpand-form '_expression_))

=3D=3D=3D orig test ca= se =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
<= font face=3D"Courier New">=C2=A0 (regexp-case str
=C2=A0 =C2=A0 (("^([a-z]+)\\(([0-9]+)\\)$" v i= )
=C2=A0 =C2=A0 =C2=A0(list v i= ))
=C2=A0 =C2=A0 (("^([a-z= ]+)$" v)
=C2=A0 =C2=A0 =C2= =A0(list v "1")))

=3D=3D=3D output from e= xpand =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

(let ((t-768 (if #f #f))

=C2=A0 =C2=A0 =C2= =A0 (t-769 (if #f #f)))

=C2=A0 (l= et ((t (regexp-exec t-768 str)))

=C2=A0 = =C2=A0 (if t

=C2=A0 = =C2=A0 =C2=A0 (let ((m t))

=C2=A0 = =C2=A0 =C2=A0 =C2=A0 (let ((v (match:substring m 1))

=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (i (match:substring m 2)))=

=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 (list v i)))

=C2=A0 = =C2=A0 =C2=A0 (let ((t (regexp-exec t-769 str)))

=C2=A0 = =C2=A0 =C2=A0 =C2=A0 (if t

=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 (let* ((m t) (v (match:substring m 1)))<= /p>

=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (list v "1"))

=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 (scm-error

=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 #f

=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "regexp-case"

=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "no match found: ~S"

=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (list str)

=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 #f))))))


=



--001a113ead28f4db0a052b7bbfa8--