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 <[email protected]> wrote:
> yes
>
> -----Original Message-----
> From: Misztur, Chris [mailto:[email protected]]
> Sent: Friday, January 31, 2014 6:12 PM
> To: William Candillon
> Cc: David Lee; [email protected]
> 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" <[email protected]> 
>> 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
>> <[email protected]> wrote:
>>> Understood, thanks.
>>>
>>> On Jan 30, 2014, at 5:06 PM, "David Lee" <[email protected]> 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:[email protected]]
>>> Sent: Thursday, January 30, 2014 5:26 PM
>>> To: David Lee
>>> Cc: [email protected]
>>> 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"
>>> <[email protected]>
>>> 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" <[email protected]> wrote:
>>>
>>> No.
>>>
>>>
>>>
>>>
>>>
>>> From: [email protected] [mailto:[email protected]] On
>>> Behalf Of Misztur, Chris
>>> Sent: Thursday, January 30, 2014 5:07 PM
>>> To: [email protected]
>>> 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
>>>
>>> _______________________________________________
>>> [email protected]
>>> 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
>>>
>>>
>>> _______________________________________________
>>> [email protected]
>>> 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
>

_______________________________________________
[email protected]
http://x-query.com/mailman/listinfo/talk

Reply via email to