From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.lisp.guile.user Subject: Re: sxml-match bad pattern syntax Date: Tue, 28 Dec 2021 09:28:32 +0100 Message-ID: References: <87h7atdzbo.fsf@gnuvola.org> <87a6gldutb.fsf@gnuvola.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="RzTh/thmukyIJgC+" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14303"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Tue Dec 28 09:28:50 2021 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n27qj-0003ak-SR for guile-user@m.gmane-mx.org; Tue, 28 Dec 2021 09:28:49 +0100 Original-Received: from localhost ([::1]:44498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n27qi-0001MU-O9 for guile-user@m.gmane-mx.org; Tue, 28 Dec 2021 03:28:48 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:44030) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n27qY-0001MM-NI for guile-user@gnu.org; Tue, 28 Dec 2021 03:28:38 -0500 Original-Received: from mail.tuxteam.de ([5.199.139.25]:35920) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n27qV-0007uu-1A for guile-user@gnu.org; Tue, 28 Dec 2021 03:28:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:To:Date:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=sjgYZgBui+T/6VTCHtbtnxoYG0FUHtl9xUtMtSgvUAw=; b=sqlwiJdOdkO1/qXp3eASuhHEdg 5yruF473XDhN90nRdk3tYu/FZr3WVY38/inqS+L235n5d97zIx4UDHg0sJBNeatHYw/iiAX8vAb+g nQ6G8goyNUTdsnDe5t6hxH68UQgtYgeS1bUxFYkTAcRQ+E7k9o4PdaM4+X3QF/4TAcOP672gCWOl6 8oTh+Fo9FmZl2poFYc0Midxd+mSM4Kt7avldek4+emG31pFIVayILG8aBv6wX+4ep1NCV+2Cmy6P/ jZhrFReszieHK0TDgFJFBKoOUYErJRB9r/oGmtDOtDfpJX8ML6aWmxQBdJIazFQL/D/sPo21gQwn8 ZG8QznBQ==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.94.2) (envelope-from ) id 1n27qS-0005i5-AO for guile-user@gnu.org; Tue, 28 Dec 2021 09:28:32 +0100 Content-Disposition: inline In-Reply-To: <87a6gldutb.fsf@gnuvola.org> Received-SPF: pass client-ip=5.199.139.25; envelope-from=tomas@tuxteam.de; helo=mail.tuxteam.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:17919 Archived-At: --RzTh/thmukyIJgC+ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Dec 28, 2021 at 02:58:56AM -0500, Thien-Thi Nguyen wrote: >=20 > () > () Tue, 28 Dec 2021 08:19:04 +0100 >=20 > I /think/ the ellipsis is at a wrong place there [...] > Haha, i know exactly how you feel. %-) > Ah, right! The ellipses are a tail that need to follow a head. No, the ellipses tell the matcher that the symbol to its left acutally stands for "zero or more of this". Consequently, you have to somehow [1] use those ellipses on the right hand side (aka template) whenever you use them on the left hand side (aka pattern) and vice versa. > I guess i was confused by the documentation's use of ellipses in > the conventional sense rather than the literal sense: I think of the ellipses as a kind of funny Kleene star. Not really at home in any world: in the regular world, because it isn't a star, in the Scheme world, because it is postfix. So, to come back on your original example, (@ . ,attrs) ... would match either empty (remember: zero or more) or (@ (foo 1) (bar 2)) or (@ (meep 1)) (@ "this ain't what we expected)) =2E.. so zero or more of (@ . stuff) where stuff stands for any S-expression (note that it's sloppy: it will match things which aren't lists of well-formed attribute lists [2]). It won't match (@ (foo 1)) (@ (bar 2)) ("rumpelstilzchen") for example. > Anyway, thanks to your help, i've managed to cobble together the > following code, attached here for the benefit of future self: [...] Thanks. And thanks for the code :) > Maybe it's idiomatic. Feedback on how to improve it welcome! For the idiomatic part, I'll have to defer to those with more chevrons ;-) Cheers [1] Yes, some handwaving here. [2] which isn't what you want to match, anyway. You want to match things with one attribute list in them. Cheers --=20 t --RzTh/thmukyIJgC+ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCYcrKqQAKCRAFyCz1etHa RvDDAJ4gOa5rGNSsfgxg4tjwIBA/2jgxtACeOQfx9P5LDY9lRE6suwuOTibsFEI= =tlKO -----END PGP SIGNATURE----- --RzTh/thmukyIJgC+--