[xquery-talk] function() inside of an element ?

David Lee dlee at calldei.com
Fri Jan 31 15:15:20 PST 2014


yes

-----Original Message-----
From: Misztur, Chris [mailto:CMisztur at macleanfogg.com] 
Sent: Friday, January 31, 2014 6:12 PM
To: William Candillon
Cc: David Lee; talk at 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" <wcandillon at 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 
> <CMisztur at macleanfogg.com> wrote:
>> Understood, thanks.
>>
>> On Jan 30, 2014, at 5:06 PM, "David Lee" <dlee at 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:CMisztur at macleanfogg.com]
>> Sent: Thursday, January 30, 2014 5:26 PM
>> To: David Lee
>> Cc: talk at 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" 
>> <CMisztur at 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" <dlee at calldei.com> wrote:
>>
>> No.
>>
>>
>>
>>
>>
>> From: talk-bounces at x-query.com [mailto:talk-bounces at x-query.com] On 
>> Behalf Of Misztur, Chris
>> Sent: Thursday, January 30, 2014 5:07 PM
>> To: talk at 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
>>
>> _______________________________________________
>> talk at 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
>>
>>
>> _______________________________________________
>> talk at 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




More information about the talk mailing list