Error XUST0001 for fold-left ?

Wednesday, 25 June 2014 · 5 messages · last reply 26 Jun 2014
MG
Maximilian Gärber25 Jun 2014 16:21 #
Hi, I just tried a previously (7.8-Snapshot) working application with 8.0-Snapshot and got: Stopped at /intersect-nodes.xqm, 22/13: [XUST0001] fn:fold-left(items,zero,function): all expressions must be updating or return an empty sequence. but there are no updates applied in this function (or ones calling this function):
declare %public function _:intersect(
    $map as map(*))
    as node()*
{
  fold-left(
    map:keys($map),
    $_:ALL,
    function($s1, $key as item()*) {
      let $s2 := $map($key),
          $a1 := _:all($s1),
          $a2 := _:all($s2)
      return if($a1)
        then if($a2) then $_:ALL else $s2
        else if($a2) then $s1 else $s1 intersect $s2
    }
  )
Any ideas? Regards, Max
CG
Christian Grün25 Jun 2014 16:25 #
Hi Max, can you possibly provide us with a small, self-contained example? Maybe the error occurs somewhere else, even if the error points to this function. An example: Maps may also contain updating functions. Cheers, Christian
Quoted text · Maximilian Gärber · 33 lines
On Wed, Jun 25, 2014 at 4:21 PM, Maximilian Gärber <mgaerber at arcor.de> wrote: > Hi, > > I just tried a previously (7.8-Snapshot) working application with > 8.0-Snapshot and got: > > Stopped at /intersect-nodes.xqm, 22/13: > [XUST0001] fn:fold-left(items,zero,function): all expressions must be > updating or return an empty sequence. > > but there are no updates applied in this function (or ones calling > this function): > > declare %public function _:intersect( > $map as map(*)) > as node()* > { > fold-left( > map:keys($map), > $_:ALL, > function($s1, $key as item()*) { > let $s2 := $map($key), > $a1 := _:all($s1), > $a2 := _:all($s2) > return if($a1) > then if($a2) then $_:ALL else $s2 > else if($a2) then $s1 else $s1 intersect $s2 > } > ) > > Any ideas? > > Regards, Max
MG
Maximilian Gärber26 Jun 2014 09:11 #
Hi, self-contained example attached, just drop to restxq enabled folder and navigate to [restxq url] /tmp/test-fold-left still gives Problem accessing /tmp/test-fold-left. Reason: Stopped at restxq/tmp/test-update-error.xqm, 33/13: [XUST0001] fn:fold-left(items,zero,function): all expressions must be updating or return an empty sequence. Regards, Max 2014-06-25 16:25 GMT+02:00 Christian Grün <christian.gruen at gmail.com>:
Quoted text · Christian Grün · 43 lines
> Hi Max, > > can you possibly provide us with a small, self-contained example? > Maybe the error occurs somewhere else, even if the error points to > this function. An example: Maps may also contain updating functions. > > Cheers, > Christian > > > On Wed, Jun 25, 2014 at 4:21 PM, Maximilian Gärber <mgaerber at arcor.de> wrote: >> Hi, >> >> I just tried a previously (7.8-Snapshot) working application with >> 8.0-Snapshot and got: >> >> Stopped at /intersect-nodes.xqm, 22/13: >> [XUST0001] fn:fold-left(items,zero,function): all expressions must be >> updating or return an empty sequence. >> >> but there are no updates applied in this function (or ones calling >> this function): >> >> declare %public function _:intersect( >> $map as map(*)) >> as node()* >> { >> fold-left( >> map:keys($map), >> $_:ALL, >> function($s1, $key as item()*) { >> let $s2 := $map($key), >> $a1 := _:all($s1), >> $a2 := _:all($s2) >> return if($a1) >> then if($a2) then $_:ALL else $s2 >> else if($a2) then $s1 else $s1 intersect $s2 >> } >> ) >> >> Any ideas? >> >> Regards, Max
CG
Christian Grün26 Jun 2014 10:09 #
Quoted text · Maximilian Gärber · 2 lines
> self-contained example attached, just drop to restxq enabled folder > and navigate to [restxq url] /tmp/test-fold-left
Appreciated! We have added an issue for that; will probably be fixed today: https://github.com/BaseXdb/basex/issues/964 Christian
CG
Christian Grün26 Jun 2014 11:16 #
Quoted text · Christian Grün · 1 line
> Appreciated! We have added an issue for that; will probably be fixed today:
Done; please try the latest snapshot! Christian

⚡Generated with XQuery