[xquery-talk] Results from previous iterations

Vyacheslav Zholudev vyacheslav.zholudev at gmail.com
Wed Nov 10 01:50:36 PST 2010


David,

> On 09/11/2010 23:57, Vyacheslav Zholudev wrote:
>> but are there any common patterns to simulate something like this?
> 
> well the particular case you describe of course is just the expression
> 2 to 11, but in general the idiom for passing values in any declarative language is to write a recursive function.
> 
> declare function local:f ($start,$finish) {
> ($start,if($start<$finish) then local:f($start+1,$finish) else ())
> };
> 
> local:f(2,11)


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...

> 
> 
> 

Best,
Vyacheslav






More information about the talk mailing list