[xquery-talk] Results from previous iterations
vyacheslav.zholudev at gmail.com
Wed Nov 10 20:00:25 PST 2010
Thanks Michael and David!
On Nov 10, 2010, at 10:21 AM, Michael Kay wrote:
>> Thanks. In this particular example, it's clear how to convert it to a recursive call (width of recursion is 1). Actually I oversimplified the example. In fact, my case is when the width of the recursion is more than 1 and each consequent recursion call depends of the result of the previous one for the same recursion height. Then it's still not clear to me how to do it in XQuery... But probably I should come up with a simple example for this case in order to illustrate the issue better, or most likely my question is broader than XQuery scope...
> Then rather than doing a simple head-tail recursion, you might consider using the fold-left() function in XQuery 1.1. (Available in Saxon and probably one or two other implementations).
> These problems can be quite difficult to get your head around. To make it a little easier for people who don't think this way (and to help optimizers devise a streaming implementation) we introduced the xsl:iterate instruction in XSLT 2.1, which is formally very similar to fold-left but written in a style that looks more like an loop with parameters.
> Michael Kay
> talk at x-query.com
More information about the talk