Not in my 6.0-2.3 environment.

declare function local:foo() {
  1
};

declare function local:bar() {
  xdmp:sleep(1000),
  2
};

(local:foo(), local:bar())[1],
xdmp:elapsed-time()
=>
1
PT1.001195S

The profiler shows the xdmp:sleep too. So I only use the [1] trick when I don't 
care about performance.

-- Mike

On 10 Apr 2013, at 20:08 , Jason Hunter <[email protected]> wrote:

> It shortcuts out like you want. 
> 
> Sent from my iPhone
> 
> On Apr 10, 2013, at 7:53 PM, Tim Finney <[email protected]> wrote:
> 
>> Hi All,
>> 
>> (foo(), bar())[1]
>> 
>> can be used instead of
>> 
>> if (exists(foo())) then foo() else bar().
>> 
>> But does MarkLogic evaluate bar() if I use the (foo(), bar())[1] 
>> construct and foo() exists? I'm interested to know because bar() could 
>> take a long time to evaluate.
>> 
>> Best,
>> 
>> Tim Finney
>> _______________________________________________
>> General mailing list
>> [email protected]
>> http://developer.marklogic.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
> 

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to