Re: [basex-talk] Stack Overflow: Try tail recursion

2019-02-20 Thread Giuseppe G. A. Celano
Thanks! This works perfectly > On Feb 19, 2019, at 6:08 PM, Bridger Dyson-Smith > wrote: > > Hi Michael - > that's a very nice solution! Thanks for sharing! > > On Tue, Feb 19, 2019 at 6:14 AM Michael Seiferle > wrote: > Hi Guiseppe, > > > unfortunately the

Re: [basex-talk] Stack Overflow: Try tail recursion

2019-02-19 Thread Bridger Dyson-Smith
Hi Michael - that's a very nice solution! Thanks for sharing! On Tue, Feb 19, 2019 at 6:14 AM Michael Seiferle wrote: > Hi Guiseppe, > > > unfortunately the example won’t be tail-call optimized as your last > statement is not the function call itself but a sequence construction that > happens

Re: [basex-talk] Stack Overflow: Try tail recursion

2019-02-19 Thread Michael Seiferle
Hi Guiseppe, unfortunately the example won’t be tail-call optimized as your last statement is not the function call itself but a sequence construction that happens to contain the function call. Your function must be of the form: > f(x) => s(x)if your termination condition is met (i.e.

Re: [basex-talk] Stack Overflow: Try tail recursion

2019-02-18 Thread Giuseppe G. A. Celano
Hi Jonathan, Thanks for that. However, it returns the same stack overflow error as the other script, when are 38000. Encreasing the JVM size does not help either. E-mail: cel...@informatik.uni-leipzig.de Web site 1:

Re: [basex-talk] Stack Overflow: Try tail recursion

2019-02-18 Thread George Sofianos
You can also increase the JVM stack size for the BaseX GUI. Example, if you are on Linux go to the BaseX bin directory, edit the basexgui file, and change these lines # Options for virtual machine (can be extended by global options) BASEX_JVM="-Xmx6g -Xss4m $BASEX_JVM" There isn't really a

Re: [basex-talk] Stack Overflow: Try tail recursion

2019-02-18 Thread Jonathan Robie
To make it tail-recursive, make the recursive call the last operation in the function. https://en.wikipedia.org/wiki/Tail_call The else() clause is what keeps it from being tail recursive. Something like this should work: *declare variable* *$bookstore* := story 50.00 smith

[basex-talk] Stack Overflow: Try tail recursion

2019-02-18 Thread Giuseppe G. A. Celano
I am writing a recursive function which is similar to the one here: https://stackoverflow.com/questions/27702718/to-add-values-in-cumulative-format Interestingly, local:sum() works if there are not many . However with 38000 book element I get the error "Stack Overflow: Try tail recursion". Any