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 08:19:04 +0100 Message-ID: References: <87h7atdzbo.fsf@gnuvola.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="pneuSCzwmiVdMcmo" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27262"; 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 08:20:15 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 1n26mN-0006xj-Bj for guile-user@m.gmane-mx.org; Tue, 28 Dec 2021 08:20:15 +0100 Original-Received: from localhost ([::1]:58774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n26mM-0005Ql-41 for guile-user@m.gmane-mx.org; Tue, 28 Dec 2021 02:20:14 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:36686) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n26lN-0005Pv-3n for guile-user@gnu.org; Tue, 28 Dec 2021 02:19:13 -0500 Original-Received: from mail.tuxteam.de ([5.199.139.25]:35910) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n26lK-0007bL-TK for guile-user@gnu.org; Tue, 28 Dec 2021 02:19:12 -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=oyHjjC10zLWxethy/n76X6P9Ll4wZlnwttblJ+IzTHM=; b=bfhpNImyBt7uLvRLgIJftKBBzN D5skNrTqOeRTKMoXioJwunoJ0m8KshDvu4dfwraYqFCF+h05SC4Mz0y0SjUAKFCYetcytk+JpknTx +VIILn1AOB44au9Jd5OWmdtFQEQHl5igyljXrKHpxZ1nOXWAjSzZxJUA/JcLdMjInDa7tRIdmY1nO NKjb+C8GJq0utO8L7IcfkE0KEsPBff1QJSAWHkSf2dFLGRqYMlBm8pcKcQGr4h6F9cknKuapo+gjp APKPCwPO1usb+662amEubNlKSLqlS0wG+FusdOPHV+AgOhGso4bEfRsK4Ae9kASjqfurQa8dwVVBP poYcF3aQ==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.94.2) (envelope-from ) id 1n26lE-0005a3-2K for guile-user@gnu.org; Tue, 28 Dec 2021 08:19:04 +0100 Content-Disposition: inline In-Reply-To: <87h7atdzbo.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:17917 Archived-At: --pneuSCzwmiVdMcmo Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Dec 28, 2021 at 01:21:31AM -0500, Thien-Thi Nguyen wrote: >=20 > In an effort to join the current millennium, :-) > i have started to > play w/ Guile 2.x's SXML facilities. Good stuff! I've run into > a problem, however, and hope i can get help resolving it here. >=20 > The following small program attempts to use =E2=80=98sxml-match=E2=80=99 = to > remove an unwanted attribute from a (well-formed) SXML snippet. > #!/usr/bin/guile -s > !# > (use-modules > (sxml match)) >=20 > (define (unbogus x) > (sxml-match x > ((a (@ . ,attrs) ...) > `(a (@ ,@(delete '(shape "rect") attrs)) ...)))) I /think/ the ellipsis is at a wrong place there. Note that I'm coming =66rom "traditional" match, and I just have wrapped half of my brain around that (which, BTW, is somewhat painful :-) So take this with a grain of salt. * Phenomenology (aka: I barely know what I'm doing): If you replace your ellipses above by ". ,rest", things seem to work: (define (unbogus x) (sxml-match x ((a (@ . ,attrs) . ,rest) `(a (@ ,@(delete '(shape "rect") attrs)) . ,rest)))) (unbogus '(a (@ (shape "rect") (href "foo.html")) "kid")) =3D> (a (@ (href "foo.html")) "kid") * Philosophy (aka blah, blah) If those ellipses resemble what match do, I think they are wrong there: (@ . ,attrs) ... would mean zero or more times the shape "(@ . ,attrs)". I think this isn't what you want. Put grains of salt everywhere :) Cheers --=20 t --pneuSCzwmiVdMcmo Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCYcq6YQAKCRAFyCz1etHa RlF4AJ43Q/5oKnOTOsyeVJl8IUITVHOQWQCfUYnYbt0XCh3e7IXWXjK0l6plXJo= =M/9Q -----END PGP SIGNATURE----- --pneuSCzwmiVdMcmo--