Well, it's not very clear to me...
> contains(?, "e") returns a single-argument function which tests whether a given string contains the letter "e".
Does it generates a function fn(s) which returns s.contains("e") ?
Functional programming seems to be strange...

Best regards,
Christophe

Le 13/04/2012 13:28, Michael Kay a écrit :


On 13/04/2012 12:01, Christophe Marchand wrote:
Hum, for my own knowledge improvment, what means the "?" argument ?


It's called "partial function application". Also known in functional programming as "currying".

For example, contains(?, "e") returns a single-argument function which tests whether a given string contains the letter "e".

So, for example, given a function filter(item()*, function(*)) which returns those items in the supplied sequence that satisfy the supplied function, you can call

filter($strings, contains(?, "e"))

to return those strings in $strings that contain the letter "e".

Michael Kay
Saxonica
------------------------------------------------------------------------------ For Developers, A Lot Can Happen In A Second. Boundary is the first to Know...and Tell You. Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/saxon-help