Hi Colleen,

I haven't used maps before.  Do you have any simple examples of mapping to a
global variable or passing a map through a function as a global variable?

Thx,

Tim

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Colleen
Whitney
Sent: Thursday, September 15, 2011 11:37 AM
To: General MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] How to effectively pass variables by
reference to an xquery function?

Yes, it's an extension, but so are try/catch blocks. 

You can bind a map to a global variable (in which case it can be referenced
and modified by any function), or create and pass maps through functions as
a local variable just like any other XQuery primitive type, as Erik
suggests.  

You can use xdmp:set to modify a global variable, but as Ron noted it does
sidestep the functional paradigm and is a very sharp tool, it's very easy to
shoot yourself in the foot if you've got various functions setting it
concurrently.  

--Colleen


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

Reply via email to