I've been searching around on Google for an answer to this, and I haven't yet 
found one: does MarkLogic support tail recursion optimization? I have a FLWOR 
that calls a function repeatedly for each item in a list. If that function 
returns something other than the empty list, it uses xdmp:set to set $has-value 
to fn:true(). Each subsequent iteration checks to see if this variable is true, 
and if it is, it just returns the empty list instead of actually calling the 
function on that item. Since, in my case, the item in the list that causes the 
function to return a value tends to be toward the beginning, this avoids the 
performance overhead of calling the function for every item in the list. 
However, I don't particularly like that the use of xdmp:set prevents my code 
from being purely-functional, so I'd like to replace this with tail recursion 
if I can.


 NOTICE: This email message is for the sole use of the intended recipient(s) 
and may contain confidential and privileged information. Any unauthorized 
review, use, disclosure or distribution is prohibited. If you are not the 
intended recipient, please contact the sender by reply email and destroy all 
copies of the original message.


_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to