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 20:43:57 +0000
Message-Id: <E1TLKBB-0005sZ-VG@jessica.w3.org>
To: public-qt-comments@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=19158

--- Comment #3 from Jakub Maly <jakub@maly.cz> 2012-10-08 20:43:57 UTC ---
How about using higher-order functions to solve this. 

Let's say there is map:process HOF and it uses an accumulator to store
intermediate results, the accumulator is initialized using the last parameter
and the value of the accumulator is returned after the last entry was
processed. 

For returning all values as one (flattened) sequence:

map:process($mymap, function($key,$value,$acc,()) { $acc, $value })

When someone wants to handle values, which can be sequences or maps, (s)he can
use more sophisticated function and accumulator structure. 

My only concern is whether calling $acc, $value would be effective (linear)?

-- 
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 20:43:59 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 8 October 2012 20:43:59 GMT