Re: [basex-talk] updating inside map:for-each

2017-11-14 Thread Kendall Shaw
On 11/14/17, 1:42 AM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of 
Christian Grün"  wrote:

> How can database updating be done inside map:for-each ?

The higher-order functions of the XQuery spec are currently restricted
to non-updating functions. You can circumvent this restriction by
enabling the MIXUPDATES option, or using traditional iterations (which
are, at least, not much slower than map:for-each):

  for $key in map:keys($map)
  let $val := $map($key)
  return (...)

I will offer that if the question is being asked because it matches what would 
be done in other languages, it’s probably a good idea to read about functional 
programming, which XQuery is associated with.  A purely  functional program 
would not directly cause side-effects within a function.

At least, some familiarity with functional programming is fundamentally 
important in learning about XQuery.

Kendall



Re: [basex-talk] updating inside map:for-each

2017-11-14 Thread Christian Grün
> How can database updating be done inside map:for-each ?

The higher-order functions of the XQuery spec are currently restricted
to non-updating functions. You can circumvent this restriction by
enabling the MIXUPDATES option, or using traditional iterations (which
are, at least, not much slower than map:for-each):

  for $key in map:keys($map)
  let $val := $map($key)
  return (...)


[basex-talk] updating inside map:for-each

2017-11-13 Thread E. Wray Johnson
How can database updating be done inside map:for-each ?