You're right
xquery version "3.0";
let $obj :=
map
{
"hello" := function($world){"Hello " || $world }
}
return $obj("hello")("World")
________________________________________
From: William Candillon [***@gmail.com]
Sent: Friday, January 31, 2014 6:12 PM
To: David Lee
Cc: Misztur, Chris; ***@x-query.com
Subject: Re: [xquery-talk] function() inside of an element ?
Here's an example with a parameter:
http://try.zorba.io/queries/xquery/yo61xtKOXtdeQn7PXtBjN%2FywU0g%3D
On Sat, Feb 1, 2014 at 12:15 AM, David Lee <***@calldei.com> wrote:
> yes
>
> -----Original Message-----
> From: Misztur, Chris [mailto:***@macleanfogg.com]
> Sent: Friday, January 31, 2014 6:12 PM
> To: William Candillon
> Cc: David Lee; ***@x-query.com
> Subject: Re: [xquery-talk] function() inside of an element ?
>
> Can the anonymous function take an arbitrary parameter?
>
>> On Jan 31, 2014, at 3:21 AM, "William Candillon" <***@gmail.com> wrote:
>>
>> Here's an example with a map extension (JSONiq in this instance):
>> let $obj := {
>> hello: function(){
>> "Hello World"
>> }
>> }
>> return $obj.hello()
>>
>> http://try.zorba.io/queries/xquery/y5RSvf%2FQpvfNSvB%2Fep%2BE3H2hYcA%3
>> D
>>
>>
>> On Fri, Jan 31, 2014 at 12:23 AM, Misztur, Chris
>> <***@macleanfogg.com> wrote:
>>> Understood, thanks.
>>>
>>> On Jan 30, 2014, at 5:06 PM, "David Lee" <***@calldei.com> wrote:
>>>
>>> yes to all that (except maps which are vendor specific)
>>>
>>>
>>>
>>> declare variable $a := function() { true() } ;
>>>
>>> ..
>>>
>>>
>>>
>>> return $a()
>>>
>>>
>>>
>>> let $x := ( 1 , $a , 2 )
>>>
>>> return ($x[2])()
>>>
>>>
>>>
>>> but elements no ... sticking a function into an element atomizes the
>>> function itself which is not allowed ... a sad state of affairs
>>> (unless you want to serialize the XML as well XML ... then its great
>>> )
>>>
>>>
>>>
>>>
>>>
>>> From: Misztur, Chris [mailto:***@macleanfogg.com]
>>> Sent: Thursday, January 30, 2014 5:26 PM
>>> To: David Lee
>>> Cc: ***@x-query.com
>>> Subject: Re: [xquery-talk] function() inside of an element ?
>>>
>>>
>>>
>>> Err the last arguments should be variables.
>>>
>>>
>>> On Jan 30, 2014, at 4:24 PM, "Misztur, Chris"
>>> <***@macleanfogg.com>
>>> wrote:
>>>
>>> Better yet, is it possible to store a function in a map whose
>>> arguments are known at runtime. In other words the functions
>>> arguments do not reference any existing arguments at design time.
>>>
>>>
>>> On Jan 30, 2014, at 4:11 PM, "David Lee" <***@calldei.com> wrote:
>>>
>>> No.
>>>
>>>
>>>
>>>
>>>
>>> From: talk-***@x-query.com [mailto:talk-***@x-query.com] On
>>> Behalf Of Misztur, Chris
>>> Sent: Thursday, January 30, 2014 5:07 PM
>>> To: ***@x-query.com
>>> Subject: [xquery-talk] function() inside of an element ?
>>>
>>>
>>>
>>> Is it possible to call the function stored inside of $el?
>>>
>>>
>>>
>>> Let $el := element f { function() { true() } }
>>>
>>>
>>>
>>>
>>>
>>> ________________________________
>>>
>>>
>>> The contents of this message may be privileged and confidential.
>>> Therefore, if this message has been received in error, please delete
>>> it without reading it. Your receipt of this message is not intended
>>> to waive any applicable privilege. Please do not disseminate this
>>> message without the permission of the author.
>>>
>>> Please consider the environment before printing this e-mail
>>>
>>>
>>>
>>> ________________________________
>>>
>>>
>>> The contents of this message may be privileged and confidential.
>>> Therefore, if this message has been received in error, please delete
>>> it without reading it. Your receipt of this message is not intended
>>> to waive any applicable privilege. Please do not disseminate this
>>> message without the permission of the author.
>>>
>>> Please consider the environment before printing this e-mail
>>>
>>> _______________________________________________
>>> ***@x-query.com
>>> http://x-query.com/mailman/listinfo/talk
>>>
>>>
>>>
>>> ________________________________
>>>
>>>
>>> The contents of this message may be privileged and confidential.
>>> Therefore, if this message has been received in error, please delete
>>> it without reading it. Your receipt of this message is not intended
>>> to waive any applicable privilege. Please do not disseminate this
>>> message without the permission of the author.
>>>
>>> Please consider the environment before printing this e-mail
>>>
>>>
>>> ________________________________
>>>
>>> The contents of this message may be privileged and confidential.
>>> Therefore, if this message has been received in error, please delete
>>> it without reading it. Your receipt of this message is not intended
>>> to waive any applicable privilege. Please do not disseminate this
>>> message without the permission of the author.
>>>
>>> Please consider the environment before printing this e-mail
>>>
>>>
>>> _______________________________________________
>>> ***@x-query.com
>>> http://x-query.com/mailman/listinfo/talk
>
> ________________________________
>
> The contents of this message may be privileged and confidential. Therefore, if this message has been received in error, please delete it without reading it. Your receipt of this message is not intended to waive any applicable privilege. Please do not disseminate this message without the permission of the author.
>
> Please consider the environment before printing this e-mail
>
________________________________
The contents of this message may be privileged and confidential. Therefore, if this message has been received in error, please delete it without reading it. Your receipt of this message is not intended to waive any applicable privilege. Please do not disseminate this message without the permission of the author.
Please consider the environment before printing this e-mail