W3C home > Mailing lists > Public > public-qt-comments@w3.org > June 2016

[Bug 29080] array:members

From: <bugzilla@jessica.w3.org>
Date: Mon, 13 Jun 2016 23:51:51 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-29080-523-12X31gEteP@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=29080

--- Comment #9 from Josh Spiegel <josh.spiegel@oracle.com> ---
Consider this query:

  declare variable $games := parse-json('[
     { "location" : "Webster", "scores" : [8, 10] },
     { "location" : "Kirkwood", "scores" : [5,7] },
     { "location" : "Webster", "scores" : [7,3] }
  ]');

  declare function local:getAverages($location) {
     $games?*[?location eq $location]?scores ! avg(.)
  };

  <result>
     <webster>{local:getAverages('Webster')}</webster>
     <kirkwood>{local:getAverages('Kirkwood')}</kirkwood>
  </result>

Currently this evaluates to:

  <result><webster>9 5</webster><kirkwood>6</kirkwood></result>

But under your proposal, it would return:

  <result><webster>9 5</webster><kirkwood>5 7</kirkwood></result>

Correct?

If so, I think a user would find this surprising.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
Received on Monday, 13 June 2016 23:51:58 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:58:00 UTC