From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Panicz Maciej Godek Newsgroups: gmane.lisp.guile.devel Subject: Inconsistent behaviour of the pattern matcher Date: Sun, 28 Apr 2013 10:12:57 +0200 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b5d3bd4019d9104db675641 X-Trace: ger.gmane.org 1367136781 21437 80.91.229.3 (28 Apr 2013 08:13:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 28 Apr 2013 08:13:01 +0000 (UTC) To: guile-devel Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun Apr 28 10:13:05 2013 Return-path: Envelope-to: guile-devel@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 1UWMjI-0003s6-9I for guile-devel@m.gmane.org; Sun, 28 Apr 2013 10:13:04 +0200 Original-Received: from localhost ([::1]:53704 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWMjH-0000L3-PP for guile-devel@m.gmane.org; Sun, 28 Apr 2013 04:13:03 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:45228) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWMjD-0000Kv-HA for guile-devel@gnu.org; Sun, 28 Apr 2013 04:13:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UWMjC-0000uk-Lv for guile-devel@gnu.org; Sun, 28 Apr 2013 04:12:59 -0400 Original-Received: from mail-vc0-f178.google.com ([209.85.220.178]:55106) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWMjC-0000ue-H5 for guile-devel@gnu.org; Sun, 28 Apr 2013 04:12:58 -0400 Original-Received: by mail-vc0-f178.google.com with SMTP id ha11so1148003vcb.37 for ; Sun, 28 Apr 2013 01:12:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=a350Wcy1wYaU9c5vN7zcYJ4tA8LEm+geWPcR66gqndg=; b=pAIG7vMZmps+L6o437o5SaYtogR1lvH3KVpgeMbrbLsYYCns4aPX8wwVdyTIjUw2Oa iQ9SSd7c8A03BqKFtkbemhI2wP1oIK/ufYdUQzfcLpg0LGS35uaLFF/GG9V4lvBWPtrR F3SLZKo+C+M6yj5MvSr2/Bny7w/qW4am1Suo6s58qvnj+BWFlG8vQZpNT0VbMvYPc3yG NUMNqYueQEsibiK++9p5Cmcy6/izu1r2Lag1AE+nSP5GLK/vd//pZajAQjKxE1OD0y1L EbxNrzu09h2v7+xZitdbJV0ir0gxV4Y1twLacs4o6mc5KPs1LFzhhRhkWrJYWZKqlSXb k2/Q== X-Received: by 10.220.186.137 with SMTP id cs9mr848501vcb.6.1367136777901; Sun, 28 Apr 2013 01:12:57 -0700 (PDT) Original-Received: by 10.220.141.10 with HTTP; Sun, 28 Apr 2013 01:12:57 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.220.178 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:16298 Archived-At: --047d7b5d3bd4019d9104db675641 Content-Type: text/plain; charset=ISO-8859-1 Hi, I've traced something that is not entirely a bug, but which was a little surprise for me. It has to do with the extensions that guile provides to the Scheme language -- namely, uniform vectors and arrays. The (ice-9 match) module offers the syntax (match #(1 2 3) (#(a b c) (list a b c))) ;===> (1 2 3) However, none of the following behaves as one could expect: (match #u8(1 2 3) (#u8(a b c) (list a b c))) (match #2((1 2)(3 4)) (#2((a b)(c d)) (list a b c d))) (match #u8(1 2 3); this is perhaps questionable, but (#(a b c) ; i add it for a discussion (list a b c))) After looking into the source of the pattern matcher, I've found out that the problem is probably situated deeper: while it is possible to define macros with regular vectors, like that: (define-syntax nv (syntax-rules () ((nv #(v ...)) (list v ...)))) it doesn't work if we replace the #(v ...) with #u8(v ...), for instance. Best regards, M. --047d7b5d3bd4019d9104db675641 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi,
I've traced something that is not entire= ly a bug, but which was a little surprise for me. It has to do with the ext= ensions that guile provides to the Scheme language -- namely, uniform vecto= rs and arrays.

The (ice-9 match) module offers the syntax<= /div>
(match #(1 2 3)
=A0 (#(a b c)
=A0 =A0(list a b c)))
;=3D=3D=3D> (1 2 3)

However, none of the following behaves as one could expect= :
(match #u8(1 2 3)
=A0 (#u8(a b c)
=A0 =A0(list a b c)))

(match = #2((1 2)(3 4))
=A0 (#2((a b)(c d))
=A0 =A0(list a b c d)))

(match #u8(1 2 3); this is perhaps questio= nable, but
=A0 (#(a b c) ; i add it for a discussion
<= div style> =A0 (list a b c)))=A0

After looking in= to the source of the pattern matcher, I've found out that the problem i= s probably situated deeper: while it is possible to define macros with regu= lar vectors, like that:

(define-syntax nv
=A0 (synt= ax-rules ()
=A0 =A0 ((nv #(v ...))
=A0 =A0 = =A0(list v ...))))

it doesn't work= if we replace the #(v ...) with #u8(v ...), for instance.

Best regards,
M.

--047d7b5d3bd4019d9104db675641--