diff --git a/map/build.xml b/map/build.xml index 6b3fce41..3c0325f5 100644 --- a/map/build.xml +++ b/map/build.xml @@ -65,7 +65,7 @@ return map:build(1 to count($fortnight), keys := function($n){$fortnight[$n]}, value := identity#1, - options := {'combine' : op('*')}) + options := {'duplicates' : op('*')}) ?Tuesday @@ -167,17 +167,6 @@ - - duplicates option and combine option both present - - - map:build((1, 2, 3, 1.0e0), options:={'duplicates':'use-first', 'combine':concat#2}) - - - - - - duplicates option with keys and values @@ -406,7 +395,7 @@ let $m := map:build(tokenize("The cat sat on the mat"), - characters#1, upper-case#1, {'combine': concat#2}) + characters#1, upper-case#1, {'duplicates': concat#2}) let $n := fold-left(tokenize("The cat sat on the mat"), map { }, fn($map, $item) { let $v := upper-case($item) return fold-left(characters($item), $map, fn($m, $k) { @@ -467,11 +456,11 @@ Test equivalence of another implementation given in spec let $m := map:build(tokenize("The cat sat on the mat"), characters#1, upper-case#1, - options := {'combine':concat#2}) + options := {'duplicates':concat#2}) let $n := ((for $item in tokenize("The cat sat on the mat") let $val := upper-case($item) for $key in characters($item) - return map:pair($key, $val) ) => map:of-pairs({'combine':concat#2})) + return map:pair($key, $val) ) => map:of-pairs({'duplicates':concat#2})) return deep-equal(trace(serialize($m, {'method':'adaptive'}), '$m'), trace(serialize($n, {'method':'adaptive'}), '$n')) @@ -636,7 +625,7 @@ map:build(("A", "B", "C", "A"), value := fn($it, $pos){$pos}, - options := {'combine' : op('+')}) + options := {'duplicates' : op('+')}) map{"A":5, "B":2, "C":3} diff --git a/map/of-pairs.xml b/map/of-pairs.xml index f2073dff..5cb9cb6f 100644 --- a/map/of-pairs.xml +++ b/map/of-pairs.xml @@ -95,7 +95,7 @@ map:of-pairs(((1 to 20) ! map{'key':., 'value':.+1}, map{'key':13, 'value':82}, map{'key':13, 'value':11}), - {'combine': op('+')}) + {'duplicates': op('+')}) 1 @@ -113,7 +113,7 @@ map:of-pairs(((1 to 20) ! map{'key':., 'value':.+1}, map{'key':13, 'value':82}, map{'key':13, 'value':11}), - {'combine':function($a,$b){$b}}) + {'duplicates':function($a,$b){$b}}) 1 @@ -129,7 +129,7 @@ map:of-pairs(((1 to 20) ! map{'key':., 'value':.+1}, map{'key':13, 'value':82}, map{'key':13, 'value':11}), - {'combine':function($a,$b){error(xs:QName('map:duplicates'))}}) + {'duplicates':function($a,$b){error(xs:QName('map:duplicates'))}}) @@ -140,7 +140,7 @@ map:of-pairs(((1 to 20) ! map{'key':., 'value':.+1}, map{'key':xs:float('NaN'), 'value':82}, map{'key':xs:double('NaN'), 'value':11}), - {'combine':op('+')}) + {'duplicates':op('+')}) 1 @@ -358,18 +358,5 @@ map{'26':42} - - - - Can't have both combine and duplicates - - - - - - - - - +