From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ricardo Wurmus Newsgroups: gmane.lisp.guile.user Subject: Re: SXML example showing diff between node-reduce and node-join Date: Mon, 11 Jan 2021 23:01:25 +0100 Message-ID: <871rerdtfu.fsf@elephly.net> References: <2d53b553-c061-21c8-fef2-5dfb8a68bdfe@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15942"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.4.13; emacs 27.1 Cc: guile-user@gnu.org To: Matt Wette Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Mon Jan 11 23:02:19 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 1kz5GU-00040x-6t for guile-user@m.gmane-mx.org; Mon, 11 Jan 2021 23:02:18 +0100 Original-Received: from localhost ([::1]:35588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kz5GT-00018l-8F for guile-user@m.gmane-mx.org; Mon, 11 Jan 2021 17:02:17 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59106) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kz5Fq-00018I-Sw for guile-user@gnu.org; Mon, 11 Jan 2021 17:01:38 -0500 Original-Received: from sender4-of-o51.zoho.com ([136.143.188.51]:21194) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kz5Fo-0004xJ-MR for guile-user@gnu.org; Mon, 11 Jan 2021 17:01:38 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1610402490; cv=none; d=zohomail.com; s=zohoarc; b=EbKmkxyjauVZLIdvjAuq1hn6Txrq38PcnUJRI8gn3WEepUC/lZxYahnFsscNcEyxiYd6ofD1Mq6IhfKPUaXhq+EKwXvUjnXdi03e9BK6sC/AtvzLn2xTj62TqCNL299a7cHd9S8saVxT0EEo/7IXOwfkjXL4lXEGrQnJGAYaPMc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610402490; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=s6sum1cBpfnoJBhZeXbnaCAmC+1eocV2Pr1qvvTz4Kk=; b=VT7XYT32Vlkui1lXVlaMwWZ5JezX4KJht3myTxVdlnYFk6ijcyYZFVZoXg7l+/NZIbtxgl98ZURSG5C+Ku+tTj4etAsISU/ZIKEtkFBqTAdL+qfWKfZs8v/dnUgXvgCMALwRnq3GJ1vi4TvuR4gf6PN9ToRHz8AUarkIbUInWsY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1610402490; s=zoho; d=elephly.net; i=rekado@elephly.net; h=References:From:To:Cc:Subject:In-reply-to:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=s6sum1cBpfnoJBhZeXbnaCAmC+1eocV2Pr1qvvTz4Kk=; b=Trz/6bO/mhqujGxqm0tOKGbvxccblbTQfTbyRrJbiV3fQgVzE9NQUoZgXXOBNoaC W1tLFSZmakyw37F0TB7FfHyAyQUB0+kXEqd/zp2UH00T4cG6YQ9Fu+IFKeokPva5pR/ hUwIWKgFg1JI0zNrUVIiUhibjh2FIMn6tmHPYoU4= Original-Received: from localhost (p54ad4da2.dip0.t-ipconnect.de [84.173.77.162]) by mx.zohomail.com with SMTPS id 1610402489173924.385259437708; Mon, 11 Jan 2021 14:01:29 -0800 (PST) In-reply-to: <2d53b553-c061-21c8-fef2-5dfb8a68bdfe@gmail.com> X-URL: https://elephly.net X-PGP-Key: https://elephly.net/rekado.pubkey X-PGP-Fingerprint: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC X-ZohoMailClient: External Received-SPF: pass client-ip=136.143.188.51; envelope-from=rekado@elephly.net; helo=sender4-of-o51.zoho.com 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 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:17175 Archived-At: Hi Matt, > I'm going through the (sxml xpath) low-level routines to try to get a > solid understanding of what they do. I just can't come up with an example > to show how node-reduce and node-join differ. If someone could provide > such an example I would really appreciate it. Takers? Here=E2=80=99s an example: --8<---------------cut here---------------start------------->8--- (define sxml (xml->sxml "\ baz great superb today yesterday " #:trim-whitespace? #true)) (define wow-converter (lambda (node-or-nodeset) (if (and (string? node-or-nodeset) (string=3D? "yesterday" node-or-nodeset)) '(new "WOW!") node-or-nodeset))) (define joined ((node-join (sxpath '(//)) (node-trace "visiting") wow-converter (sxpath '(*text*))) sxml)) (define reduced ((node-reduce (sxpath '(//)) (node-trace "visiting") wow-converter (sxpath '(*text*))) sxml)) --8<---------------cut here---------------end--------------->8--- The node-trace converter already shows that they behave differently. The wow-converter only gets to see the plain string =E2=80=9Cyesterday=E2= =80=9D when it is used with node-join. Clearly, this is not the best example one could come up with, but I hope it=E2=80=99s a start. --=20 Ricardo