GNU bug report logs - #9567
curious match bug (?)

Previous Next

Package: guile;

Reported by: Andy Wingo <wingo <at> pobox.com>

Date: Wed, 21 Sep 2011 03:36:01 UTC

Severity: normal

Done: ludo <at> gnu.org (Ludovic Courtès)

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Israelsson Tampe <stefan.itampe <at> gmail.com>
To: 9567 <at> debbugs.gnu.org, Andy Wingo <wingo <at> pobox.com>
Subject: bug#9567: curious match bug (?)
Date: Wed, 21 Sep 2011 14:15:53 +0200
[Message part 1 (text/plain, inline)]
This is an old bug I spotted before, it can be solved by inserting an extra
let
in the expansion aka

(macroexpand '(match a (par code  ...))
-> '(let ((arg a)) ....)

This is missing from atoms in match so I added that there and the
missbehavior dissapears. see the git diffed patch in this post.


On Wed, Sep 21, 2011 at 5:34 AM, Andy Wingo <wingo <at> pobox.com> wrote:

> Hi,
>
> Try this:
>
>  (use-modules (language tree-il) (ice-9 match))
>  (define foo (parse-tree-il '(let-values (apply (lambda () (lambda-case
> ((() #f #f #f () ()) (apply (primitive values) (const 1) (const 2))))))
> (lambda-case (((a b) #f #f #f () (#{a 134390}# #{b 134391}#)) (apply
> (primitive list) (lexical a #{a 134390}#) (lexical b #{b 134391}#)))))))
>  (match foo
>    (($ <let-values> src exp
>        ($ <lambda-case> src2 req #f #f #f () gensyms body #f))
>     #t)
>    (_
>     #f))
>  => #t
>
>  (match foo
>    (($ <let-values> src foo ;; <- rename "exp" to "foo"
>        ($ <lambda-case> src2 req #f #f #f () gensyms body #f))
>     #t)
>    (_
>     #f))
>  => #f
>
> I tried to reduce this case a bit, but didn't succeed directly, and I
> need to move on.  But what is the deal here?
>
> Andy
> --
> http://wingolog.org/
>
>
>
>
[Message part 2 (text/html, inline)]
[match-bug.patch (text/x-patch, attachment)]

This bug report was last modified 13 years and 222 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.