From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.devel Subject: Re: Inconsistent behaviour of the pattern matcher Date: Sun, 28 Apr 2013 13:30:03 -0400 Message-ID: <8738ua1s2s.fsf@tines.lan> References: <877gjm24yj.fsf@tines.lan> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1367170228 24214 80.91.229.3 (28 Apr 2013 17:30:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 28 Apr 2013 17:30:28 +0000 (UTC) Cc: guile-devel , Panicz Maciej Godek To: Stefan Israelsson Tampe Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun Apr 28 19:30:32 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 1UWVQk-0000SR-Lh for guile-devel@m.gmane.org; Sun, 28 Apr 2013 19:30:30 +0200 Original-Received: from localhost ([::1]:56838 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWVQk-00018q-2E for guile-devel@m.gmane.org; Sun, 28 Apr 2013 13:30:30 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:53283) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWVQe-00018K-1y for guile-devel@gnu.org; Sun, 28 Apr 2013 13:30:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UWVQb-0000lN-Hh for guile-devel@gnu.org; Sun, 28 Apr 2013 13:30:24 -0400 Original-Received: from world.peace.net ([96.39.62.75]:43716) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWVQb-0000kw-Dx for guile-devel@gnu.org; Sun, 28 Apr 2013 13:30:21 -0400 Original-Received: from ip68-9-118-38.ri.ri.cox.net ([68.9.118.38] helo=tines.lan) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1UWVQS-00023y-Ml; Sun, 28 Apr 2013 13:30:14 -0400 In-Reply-To: (Stefan Israelsson Tampe's message of "Sun, 28 Apr 2013 18:29:18 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 96.39.62.75 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:16304 Archived-At: Stefan Israelsson Tampe writes: > On Sun, Apr 28, 2013 at 2:51 PM, Mark H Weaver wrote: > > Panicz Maciej Godek writes: > > > (match #u8(1 2 3) > > (#u8(a b c) > > (list a b c))) > > This can't work because a uniform numeric vector cannot hold > symbols, so > #u8(a b c) cannot be represented in the source code. > > please note a b c binds to values and is not symbols as in the pmatch > matcher or match quasiquoute > patterns. So with the right binder this could work. Read what I wrote again: "#u8(a b c) cannot be represented in the *source* code." Remember that in Scheme (and Lisp), code is represented as data. So what datum do you expect 'read' to return after it consumes "#u8(a b c)"? We could extend (ice-9 match) to support uniform numeric vectors, but the pattern syntax would have to be different. > If you want generic accessors, I guess the array accessors are > what you > want. Patches to extend the pattern matcher to handle arrays are > welcome :) > > Actually for ice-9 match we would like the upstream version to > implement these concepts > Try ask foof on irc #scheme if he accept a patch to implement this in > a portable way or ask > him if he thinks he could spend time on it! Given that Guile's arrays are specific to Guile and not portable, I doubt that foof would be interested in supporting them upstream. > Only if we could accept a slow implementation of the matcher we can > implement a general vector > matcher by patching vector-ref etc. Beyond the efficiency considerations, I'm not sure it's desirable for the pattern #(a b c) to match #u8(1 2 3). Mark