Close. :-)

On Apr 2, 2010, at 4:15 PM, spig wrote:

> So, let me make sure I understand.
> 
> When I declare a function with any number of parameters, if one of those 
> parameters requires a singleton, and I pass in an empty sequence, the 
> function will not likely be called if function mapping is on. This makes 
> sense to me now.

With function mapping enabled, if a function takes a singleton argument, and 
you pass in a sequence, your function will be called n times, where n is the 
length of the sequence. This is true even when n is 0.


> 
> And, by similar logic, it will not throw an error because the function 
> requires a singleton parameter, and I have provided one, albeit the empty 
> sequence. And, since the empty sequence is a valid singleton (is that true) 
> it will not throw an error because the parameters are valid.

Actually, empty sequence is never a valid instance of a singleton type. In 
cases like these the error fails to throw not because the parameter is valid, 
but because the function itself never gets called.

This is easy to get mixed up. I still do at times. -m


_______________________________________________
General mailing list
General@developer.marklogic.com
http://xqzone.com/mailman/listinfo/general

Reply via email to