W3C home > Mailing lists > Public > public-qt-comments@w3.org > October 2012

[Bug 19158] Getting all vales from a map

From: <bugzilla@jessica.w3.org>
Date: Mon, 08 Oct 2012 22:30:43 +0000
Message-Id: <E1TLLqV-0004li-Kr@jessica.w3.org>
To: public-qt-comments@w3.org

--- Comment #4 from Michael Kay <mike@saxonica.com> 2012-10-08 22:30:43 UTC ---
I think the idea of a map:process() calling a user-supplied function with two
arguments - key and value - makes good sense; effectively a mapping function
applied to the entries in a map. I can't see a good use case for a "fold" (or
accumulator) capability here, since the order of processing would be undefined,
and aggregation across the entries in a map isn't an especially common use

The flattened set of values could be achieved simply with

map:process($map, function($k, $v){$v})

Conversion to an element structure would look like this:

<xsl:function name="f:pair">
  <xsl:param name="key"/>
  <xsl:param name="value"/>
  <pair key="{$key}" value="{$value}"/>

map:process($map, f:pair#2)

Feels good.

Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
Received on Monday, 8 October 2012 22:30:44 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:57:40 UTC