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: Ludovic Courtès <ludo <at> gnu.org>, 9567 <at> debbugs.gnu.org,  wingo <at> pobox.com
Subject: bug#9567: curious match bug (?)
Date: Fri, 23 Sep 2011 18:24:30 +0200
[Message part 1 (text/plain, inline)]
On the other hand

(let ((pat '(a _ ...)))
   (match '(x y z) (pat #t)))
$1 = #t

as well,

a more canonical example of this problem (where I saw it first)
are when using 'and' e.g.

(define a '(1 2))

(match a ((and (a 2) (1 b)) (+ a b)) (_ #f))
-> #f

But with my fix you wil get the correct 3.

Now the reson are that for 'and' as well as for '$' another location a is
under the command
of an implicit (let ((a car)) ...). One could perhaps argue that this is a
bug in syntax handling but I would not think so. Anyway maybe we should
consider moving this fix upstream.

/Stefan
2011/9/23 Ludovic Courtès <ludo <at> gnu.org>

> Could it be a feature?
>
>  (let ((pat '('a _ ...)))
>    (match '(a b c) (pat #t)))
>  => #t
>
> Ludo'.
>
>
>
>
[Message part 2 (text/html, inline)]

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.