Hi Rob,
A short variant of your approach could look like this:
import module namespace counter = 'java.util.concurrent.atomic.AtomicInteger'; for $i in 1 to 10 return counter:incrementAndGet()
As you already indicated, it violates the functional programming design, so I would surely recommend everyone to use the GFLWOR "at" or "count" clause (or possibly fold-left, etc.)
And hi Ron,
Do you need to start with an existing counter when running your query, or is it sufficient to start with 1?
Christian
On Thu, Oct 22, 2015 at 9:07 AM, Rob Stapper r.stapper@lijbrandt.nl wrote:
Hi Ron,
Maybe the attached codes-nippet is useful to you. It is an example of stateful programming, which isn't compliant with the functional programming concept but, in some cases, can be very useful.
Hopes it helps, Rob Stapper
PS. put the module-file in a subdirectory: "counter", in your basex-repo-directory.