<div dir="ltr">Ignore my last sentence, I don't want to make this claim.<br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-06-26 16:38 GMT+02:00 W.S. Hager <span dir="ltr"><<a href="mailto:wshager@gmail.com" target="_blank">wshager@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">On the whole I agree, and I respect the current status quo of the specification. However, I expect more changes will follow from actually working with it. IMHO the current distinction between sequences and arrays could eventually be abolished.<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2015-06-26 16:21 GMT+02:00 Michael Kay <span dir="ltr"><<a href="mailto:mike@saxonica.com" target="_blank">mike@saxonica.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span><blockquote type="cite"><div><div dir="ltr"><div><div><div><br></div>Agreed, it could be implemented as a user-defined function (although this particular solution currently throws an error in eXist). However, what bothers me is that fn:index-of(1,2,[3,4], 3) may lead to unexpected results, because the array is flattened. I get the impression that array-specific semantics are sacrificed here, where in other cases they aren't, and the dividing line is still unclear me.<br></div></div></div></div></blockquote><div><br></div></span><div>Arrays will give unexpected results, full stop. We spent two years trying to find a design that didn’t have unexpected results, and we failed. Start with the fact that $A[1] returns the whole array, and that you can’t iterate over arrays with FLWOR expressions. Arrays are grafted on to the data model as an afterthought, and it shows right through. That’s not for want of trying: we were running out of names for all the different ideas we rejected as unworkable.</div><div><br></div><div>The choice of functions in the library is inevitably arbitrary. I think we found that if you wanted a completely minimalist approach, everything could be defined in terms of three functions. At the other extreme you would have the functx approach, a thousand functions to do everything you could ever imagine, but where it’s quicker to write the function yourself than to find it in the library.</div><span><font color="#888888"><div><br></div><div>Michael Kay</div><div>Saxonica</div></font></span><div><div><br><blockquote type="cite"><div><div dir="ltr"><div><div><br></div>Thanks,<br></div>Wouter<br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-06-26 14:16 GMT+02:00 Michael Kay <span dir="ltr"><<a href="mailto:mike@saxonica.com" target="_blank">mike@saxonica.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>I would think both of these could be implemented as user-defined functions but it’s hard to know without seeing a specification: saying you want a function called array:index-of() is not very informative unless you explain exactly what you want the function to do.</div><div><br></div><div>If it’s to behave like fn:index-of() then you can write it as</div><div><br></div><div><div>array:index-of($array, $value) {</div><div>   (1 to array:size($array))[ $array(.) = $value ]</div><div>}</div></div><div><br></div><div>which is hardly a great hardship to write as a user-defined function.</div><div><br></div><div><br></div><div>Michael Kay</div><div>Saxonica</div><br><div><blockquote type="cite"><div><div><div>On 26 Jun 2015, at 12:18, W.S. Hager <<a href="mailto:wshager@gmail.com" target="_blank">wshager@gmail.com</a>> wrote:</div><br></div></div><div><div><div><div dir="ltr"><div>Hello,<br><br></div>I've been working with the recent xquery 3.1 implementation in the develop branch eXist-db. I encountered some cases that were quite hard to work around:<div><br></div><div>- the lack of array:index-of()</div><div>- the lack of the iterator index in arrayfor-each and related higher-order functions</div><div><div><div><br></div><div>Perhaps someone of the workgroup is available to discuss those cases.</div><div><br></div><div>Thanks,</div><div>Wouter<br>-- <br><div><div><p> 
W.S. Hager<br>
Lagua Web Solutions<br>
<a href="http://lagua.nl/" target="_blank">http://lagua.nl</a><br></p></div></div>
</div></div></div></div>
<br><br>-- <br><div><p> 
W.S. Hager<br>
Lagua Web Solutions<br>
<a href="http://lagua.nl/" target="_blank">http://lagua.nl</a><br></p></div><br></div></div>
_______________________________________________<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></div></blockquote></div><br></div></blockquote></div><br><br clear="all"><br>-- <br><div><div><p> 
W.S. Hager<br>
Lagua Web Solutions<br>
<a href="http://lagua.nl/" target="_blank">http://lagua.nl</a><br></p></div></div>
</div>
</div></blockquote></div></div></div><br></div></blockquote></div><br><br clear="all"><br>-- <br><div><div>
<p> 
W.S. Hager<br>
Lagua Web Solutions<br>
<a href="http://lagua.nl/" target="_blank">http://lagua.nl</a><br></p></div></div>
</div>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div>
<p> 
W.S. Hager<br>
Lagua Web Solutions<br>
<a href="http://lagua.nl/" target="_blank">http://lagua.nl</a><br></p></div></div>
</div>