atom feed2 messages in com.marklogic.developer.generalRe: [MarkLogic Dev General] Ensuring ...
FromSent OnAttachments
Eliot KimberNov 11, 2017 3:24 pm 
Dave CasselNov 12, 2017 6:04 am 
Subject:Re: [MarkLogic Dev General] Ensuring That Tail Recursion Optimization Will Be Applied
From:Dave Cassel (Davi@marklogic.com)
Date:Nov 12, 2017 6:04:53 am
List:com.marklogic.developer.general

The documentation refers to it as "tail call optimization." See http://docs.marklogic.com/guide/xquery/programming#id_93922. (I agree that the phrase "tail recursion" ought to appear in the docs.)

-- Dave Cassel, @dmcassel <https://twitter.com/dmcassel> Manager/Senior Staff Engineer MarkLogic Labs MarkLogic Corporation <http://www.marklogic.com/>

http://developer.marklogic.com/

On 11/11/17, 6:24 PM, "gene@developer.marklogic.com on behalf of Eliot Kimber" <gene@developer.marklogic.com on behalf of ekim@contrext.com> wrote:

ML 9

I¹m using recursive functions to process an arbitrarily large set of items where in a procedural language I would use a while true() loop. The number of items can be large so tail recursion optimization has to be in place or I¹ll eventually blow the call stack.

My question: How do I ensure that my functions are constructed so that tail recursion optimization will be applied?

A search on ³recursion² or ³tail recursion² didn¹t reveal anything on the ML docs site.