Hi Andy,
Am 02.11.2011 17:07, schrieb Andy Bunce:
declare function local:add($x){ $x+1 }; let $b:=local:add return $b(4) [...] Have I got the syntax wrong, or is this a bug?
it's the syntax, the expression "local:add" is interpreted as an axis step. Function item literals have to specify the number of arguments, as there may be different functions with the same name. So you'd have to write local:add#1 .
You could also use partial application (local:add(?)) or write your own inline function wrapping the function call (function($x) { local:add($x) }). All three versions compile to basically the same code:
declare function local:add($x){ $x+1 };
let $a := local:add#1, $b := local:add(?), $c := function($x) { local:add($x) } return ($a(1), $b(2), $c(3))
Hope that helps! Cheers, Leo