[xquery-talk] How to Reverse an Array

Ghislain Fourny g at 28.io
Mon Jul 20 01:57:25 PDT 2015


Hi Mike,

Ah yes, it makes sense. Thanks for correcting me. This is likely to be
the reason why there is an array:reverse function in the first place.

I still had the JSONiq mindset where array members are single items. :-)

Kind regards,
Ghislain


On Fri, Jul 17, 2015 at 4:54 PM, Michael Kay <mike at saxonica.com> wrote:
>
>> On 17 Jul 2015, at 14:31, Ghislain Fourny <g at 28.io> wrote:
>>
>> Hi Eliot,
>>
>> I'd just go to the sequence space and back:
>>
>> array { reverse(array:flatten($array)) }
>>
>
> That doesn’t work if the array contains sequences (of length > 1) - flattening loses the sequence boundaries.
>
> Michael Kay
>



More information about the talk mailing list