<div dir="ltr"><div><div dir="auto">Great, thank you, Emmanuel!  That is much better.</div><div dir="auto"><br></div><div>I might just offer one enhancement - switching from a FLWOR to the simple map operator:</div><div><br></div><div>```</div><div><div>xquery version "3.1";</div><div><br></div><div>let $letters-numbers := map { "a": 1, "b": 2, "c": 3 }</div><div>let $keys := map:keys($letters-numbers)</div><div>return (</div><div>    array { $keys },</div><div>    array { $keys ! map:get($letters-numbers, .) }</div><div>)</div></div><div>```</div><div dir="auto"><br></div><div dir="auto">Joe</div><br><div class="gmail_quote"><div>On Sat, Jul 15, 2017 at 12:12 PM Emmanuel Chateau <<a href="mailto:emchateau@laposte.net" target="_blank">emchateau@laposte.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
I would say<br>
<br>
```<br>
let $letters-numbers := map { "a": 1, "b": 2, "c": 3 }<br>
let $keys := map:keys($letters-numbers)<br>
return (<br>
  array { $keys },<br>
  array { for $key in $keys return map:get($letters-numbers, $key) }<br>
)<br>
```<br>
> Le 15 juil. 2017 à 11:41, Joe Wicentowski <<a href="mailto:joewiz@gmail.com" target="_blank">joewiz@gmail.com</a>> a écrit :<br>
><br>
> Hi all,<br>
><br>
> Is there an efficient way to transform entries in a map into two arrays, one containing the keys and one containing the values?  Here's my attempt:<br>
><br>
> ```<br>
> xquery version "3.1";<br>
><br>
> let $letters-numbers := map { "a": 1, "b": 2, "c": 3 }<br>
> return<br>
>     (<br>
>         array { map:keys($letters-numbers) },<br>
>         array { $letters-numbers?* }<br>
>     )<br>
> ```<br>
><br>
> This successfully takes `map { "a": 1, "b": 2, "c": 3 }` and returns (["a", "b", "c"], [1, 2, 3]), but the way it iterates through the map twice strikes me as somewhat inefficient.  Is there a better way to reduce this to a single pass through the map, or is this actually the best approach?<br>
><br>
> Joe<br>
> ______________________________<wbr>_________________<br>
> <a href="mailto:talk@x-query.com" target="_blank">talk@x-query.com</a><br>
> <a href="http://x-query.com/mailman/listinfo/talk" rel="noreferrer" target="_blank">http://x-query.com/mailman/<wbr>listinfo/talk</a><br>
<br>
</blockquote></div></div></div>