Hi,
Wouldn't clj-ds [1] be of any help in this? It has support for transients.I believe that Exist uses this somewhere in their code not sure where. I think it makes use of these Atomic* objects under the hood but providing a "functional" facade. btw I'm not speaking from experience with this library but I do have it on my longlist.
[1]: https://github.com/krukow/clj-ds
On Thu, Oct 22, 2015 at 9:38 AM, Christian GrĂ¼n christian.gruen@gmail.com wrote:
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.