Re: [xsl] XQuery/XPath 3.1: Node List to Node Set ("distinct nodes")

Subject: Re: [xsl] XQuery/XPath 3.1: Node List to Node Set ("distinct nodes")
From: "Liam R. E. Quin liam@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 29 Dec 2021 19:45:45 -0000
On Wed, 2021-12-29 at 18:34 +0000, Michael Kay mike@xxxxxxxxxxxx wrote:
> 
> As Dimitre says, ($n except $a) where $n is a singleton isn't
> immediately intuitive - but intuition takes practice!

I'd be tempted to write,

 function($found-so-far, $new) {
    (
      $found-so-far,
      if (some $try in $found-so-far satisfies $try is $new)
      then ()
      else $new
    )
  }

mostly because a year from now i'll likely still understand it :)

Liam


-- 
Liam Quin,B https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations: B http://www.fromoldbooks.org

Current Thread