<div dir="ltr"><div>Okay I see what you are getting at but in light of the fact that there is not a set type, but there is an array type, could you not just use the array type with the XPath 3.1 function arrays:for-each?<br><br></div><div>Regards polluting your code, you would only have that if you chose to access the array by index, instead you could just stick to for-each.<br></div><div><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div link="blue" vlink="purple" lang="NL"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US">Well, I see an array as a specialized dataSet. <u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US">I see an array is an indexed, c.q. subscripted, dataset.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US">Or I see a dataset is an array without the indexing-mechanism.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US">Or you could also see a dataset as an map without the mapping-mechanism.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US">What remains is a dynamic set with data-items where the items can individually be processed, e.g. by a for-each function, but not individually be addressed.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US">Using arrays as datasets pollutes my code with its addressing mechanism.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US">Especially for a function language expressiveness of the language should be one of the highest goods.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US">Rob<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d" lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">Van:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Adam Retter [mailto:<a href="mailto:adam.retter@googlemail.com" target="_blank">adam.retter@googlemail.com</a>] <br><b>Verzonden:</b> zondag 19 juli 2015 12:02<br><b>Aan:</b> Rob Stapper<br><b>CC:</b> <a href="mailto:talk@x-query.com" target="_blank">talk@x-query.com</a><br><b>Onderwerp:</b> Re: [xquery-talk] set as datatype in xquery<u></u><u></u></span></p><span class=""><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">Can you tell me how you see a dataSet being different to an array?<u></u><u></u></p></div></span><div><p class="MsoNormal"><u></u> <u></u></p><div><span class=""><p class="MsoNormal">On 19 July 2015 at 10:27, Rob Stapper <<a href="mailto:r.stapper@lijbrandt.nl" target="_blank">r.stapper@lijbrandt.nl</a>> wrote:<u></u><u></u></p></span><div><span class=""><div><p class="MsoNormal">Hello,<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal"><span lang="EN-US">Is it an option to add a “dataSet” as datatype in xquery, like for example the “array”?</span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-US">My case is that I’m having this high-order function that iterates through a sequence and start a given function on each item until it receives back an ‘nothing’, than it breaks off.</span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-US">This works great except with sequences which I ( have to) use for “dataSets”: there are occasions that I need to return an empty set without breaking of the iteration.</span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-US">In xquery there are empty arrays, empty maps and empty elements but no empty “dataset”, like - set {} -</span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-US">Thanx,</span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-US">Rob Stapper</span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-US">PS.</span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-US">- definition for “dataset” could be something like: - a datatype representing a dynamic collection of data-items –.</span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-US">- Since the “dataSet” is an datatype, “dataSets” could hold other dataSets.</span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-US">- Function “for-each” (  no particular sequence) could take a “dataset” but “fold-left” and “fold-right” ( particular sequence) could not.</span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-US">- I don’t know if a “fold”-function ( no particular sequence) would make sense, haven’t thought about it enough.</span><u></u><u></u></p><p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12.0pt"><u></u> <u></u></p><div class="MsoNormal" style="text-align:center" align="center"><hr style="color:#909090" align="center" noshade size="2" width="99%"></div></span><table style="border-collapse:collapse" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="padding:0cm 11.25pt 0cm 6.0pt"><p class="MsoNormal"><a href="https://www.avast.com/antivirus" target="_blank"><span style="border:solid windowtext 1.0pt;padding:0cm;text-decoration:none"><img src="cid:~WRD000.jpg" alt="Afbeelding verwijderd door afzender. Avast logo" height="100" border="0" width="100"></span></a><u></u><u></u></p></td><td style="padding:.75pt .75pt .75pt .75pt"><p><span style="font-family:"Calibri","sans-serif";color:#3d4d5a">Dit e-mailbericht is gecontroleerd op virussen met Avast antivirussoftware. <br><a href="https://www.avast.com/antivirus" target="_blank">www.avast.com</a> <u></u><u></u></span></p></td></tr></tbody></table><p class="MsoNormal"><u></u> <u></u></p></div><span class=""><p class="MsoNormal"><br>_______________________________________________<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" target="_blank">http://x-query.com/mailman/listinfo/talk</a><u></u><u></u></p></span></div><span class=""><p class="MsoNormal"><br><br clear="all"><br>-- <u></u><u></u></p><div><p class="MsoNormal">Adam Retter<br><br>skype: adam.retter<br>tweet: adamretter<br><a href="http://www.adamretter.org.uk" target="_blank">http://www.adamretter.org.uk</a><u></u><u></u></p></div></span></div></div><span class="">
<br><br>
<hr style="border:none;color:#909090;background-color:#b0b0b0;min-height:1px;width:99%">
<table style="border-collapse:collapse;border:none">
        <tbody><tr>
                <td style="border:none;padding:0px 15px 0px 8px">
                        <a href="https://www.avast.com/antivirus" target="_blank">
                                <img src="http://static.avast.com/emails/avast-mail-stamp.png" alt="Avast logo" border="0">
                        </a>
                </td>
                <td>
                        <p style="color:#3d4d5a;font-family:"Calibri","Verdana","Arial","Helvetica";font-size:12pt">
                                Dit e-mailbericht is gecontroleerd op virussen met Avast antivirussoftware.
                                <br><a href="https://www.avast.com/antivirus" target="_blank">www.avast.com</a>
                        </p>
                </td>
        </tr>
</tbody></table>
<br>
</span></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">Adam Retter<br><br>skype: adam.retter<br>tweet: adamretter<br><a href="http://www.adamretter.org.uk" target="_blank">http://www.adamretter.org.uk</a></div>
</div></div></div>