Changes

Jump to navigation Jump to search
<pre class="brush:xquery">
let $insert-with := function($f, $map, $k, $v) {
let $old := $map($k), let $new := if($old) then $f($v, $old) else $v return map:newmerge(($map, map { :entry($k: , $new }))) }
let $map := map { 'foo': 1 }
let $add := $insert-with(function($a, $b) {$a + $b}, ?, ?, ?), let $insert ins := $insert-with(hof:const#2, ?, ?, ?)
return (
$add($map, 'foo', 2)('foo'),
$insertins($map, 'foo', 42)('foo')
)
</pre>
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu