Ah right, you can't overload a variable of course.<br><br>Op maandag 14 maart 2016 heeft Ghislain Fourny <<a href="mailto:g@28.io">g@28.io</a>> het volgende geschreven:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi WS,<br>
<br>
Higher-order functions were added in XQuery 3.0 so that you can build<br>
them dynamically (using closures) and pass them as parameters like any<br>
other items.<br>
<br>
I see little benefit in defining your function as a variable<br>
declaration with an inline function expression vs. a static function<br>
declaration such as<br>
<br>
declare function local:id($x) {<br>
  $x<br>
};<br>
<br>
You can reference the former with $local:id and the latter with<br>
local:id#1 to make them flow around as function items. You can call<br>
the former with $local:id($x) and the latter with local:id($x). The<br>
former has no name, the latter has a name (local:id).<br>
<br>
When you need a function that dynamically depends on the value of a<br>
variable at runtime, however, you will need to use inline function<br>
expressions. Variables in scope will be added to the closure of the<br>
created function item.<br>
<br>
I hope it helps!<br>
<br>
Kind regards,<br>
Ghislain<br>
<br>
On Mon, Mar 14, 2016 at 2:48 PM, W.S. Hager <<a href="javascript:;" onclick="_e(event, 'cvml', 'wshager@gmail.com')">wshager@gmail.com</a>> wrote:<br>
> Hello,<br>
><br>
> What is the difference between a function declaration and a function<br>
> expression in a variable declaration, eg:<br>
><br>
> declare variable $local:id := function($x) { $x }<br>
><br>
> and why does it exist?<br>
><br>
> --<br>
><br>
> W.S. Hager<br>
> Lagua Web Solutions<br>
> <a href="http://lagua.nl" target="_blank">http://lagua.nl</a><br>
><br>
><br>
> _______________________________________________<br>
> <a href="javascript:;" onclick="_e(event, 'cvml', 'talk@x-query.com')">talk@x-query.com</a><br>
> <a href="http://x-query.com/mailman/listinfo/talk" target="_blank">http://x-query.com/mailman/listinfo/talk</a><br>
</blockquote><br><br>-- <br><div>
<p> 
W.S. Hager<br>
Lagua Web Solutions<br>
<a href="http://lagua.nl/" target="_blank">http://lagua.nl</a><br></p></div><br>