Dear all,
I have been playing with the following toy implementation of a super-simple associative map (it's mainly an exercise in demonstrating the use of h-o functions in XQuery 3.0):
declare namespace map = "http://db.inf.uni-tuebingen.de/map";
declare function map:entry($map, $k, $v) { function($x) { if ($x eq $k) then $v else $map($x) } };
declare function map:empty() { function($x) { () } };
let $map := map:empty(), $map1 := map:entry($map, 1, ("one", "eins", "uno")), $map2 := map:entry($map1, 2, ("two", "zwei", "due")) return $map2(1)
The execution of this script with BaseX 7.3 unexpectedly yields
Stack Overflow: circular variable declaration?
Note that replacing $map2(1) by $map1(1) in the last line returns the expected result ("one", "eins", "uno").
I'd be grateful for any comment/insight.
Cheers and keep up the good work, --Torsten