Re: Allowing the for member syntax to enumerate key/value pairs in a map.

On Fri, 18 Dec 2020 at 04:27, Dimitre Novatchev <dnovatchev@gmail.com>
wrote:

>
> On Thu, Dec 17, 2020 at 2:33 PM Reece Dunn <msclrhd@googlemail.com> wrote:
>
>
>> I would be happy with functions to get the sequence of members/entries
>> from an array or map instead of a specific `for member` syntax. Other
>> languages provide both a map:values and a map:entries function in addition
>> to the existing map:keys function, so that and having a non-recursive
>> array:flatten would be useful.
>>
>
> There is already array:flatten in XPath 3.1:
>
> https://www.w3.org/TR/xpath-functions-31/#func-array-flatten
>

The array:flatten function is recursive, so `array:flatten([1, [2, 3], 4])`
will yield the sequence `(1, 2, 3, 4)`, not `(1, [2, 3], 4)`, so cannot be
used if you just want to enumerate the members of the array! That is what
Christian Grün is referring to, and what I meant by a "non-recursive
array:flatten".

Kind regards,
Reece

Received on Friday, 18 December 2020 07:42:59 UTC