Hi Jason, Thanks for your reply. I have a profiler set up and its timings suggest that the (foo(), bar(args))[1] is not short-circuiting when foo() exists. Different timings occur when I substitute different bar(args) functions and foo() exists.
Best, Tim Finney On 04/11/2013 11:08 AM, Jason Hunter 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
