From: Florent G. <li...@fg...> - 2012-04-18 21:22:54
|
Wolfgang Meier wrote: Hi, > http://demo.exist-db.org/exist/apps/wiki/blogs/eXist/HoF Great article, thanks Wolfgang! Just one note, about the example for currying: let $f := string-join(?, " ") return $f(("Hello", "world!")) I'm not sure this is the best example possible, because of the "one param sequence with two strings" gotcha. One has to spot (and understand) the meaning of the embedded parens, which is not always abvious to (even not so-) beginners. If one fails to spot it (or to understand it), then one can see two params there... Maybe one of the following could be more clear? let $f := contains(?, 'world') return $f('Hello, world!') or: declare function my:add($lhs as xs:integer, $rhs as xs:integer) as xs:integer { $lhs + $rhs }; let $f := my:add(10, ?) return $f(32) It's good to see articles about new XQuery/XPath/XSLT 3.0 features, especially about first-class citizen functions and higher-order functions! (and to see them implemented in eXist :-p) Regards, -- Florent Georges http://fgeorges.org/ http://h2oconsulting.be/ |