Skip to content

Instantly share code, notes, and snippets.

@hansenmc
hansenmc / arrow_operator.xqy
Created January 2, 2016 00:29
MarkLogic supports the Arrow Operator =>
xquery version "3.1"; (: version must be 3.1 :)
(: http://www.w3.org/TR/xpath-31/#id-arrow-operator :)
"Happy " || current-date() => year-from-date() || "!"
@hansenmc
hansenmc / simple_map_operator.xqy
Last active January 2, 2016 00:29
MarkLogic supports XPath 3.0 Simple Map Operators !
xquery version "1.0-ml"; (: also works with 3.0, 3.1:)
(: http://www.w3.org/TR/xpath-30/#id-map-operator :)
let $letters := ("Alpha", "Beta", "Gamma") ! substring(., 1, 1)
return string-join($letters, ", ")
@hansenmc
hansenmc / inline_function_expressions.xqy
Last active January 1, 2016 22:14
MarkLogic supports XPath 3.0 Inline Function Expressions
xquery version "1.0-ml";
(: http://www.w3.org/TR/xpath-30/#id-inline-func :)
let $square := function($i as xs:integer) as xs:integer {
$i * $i
}
return $square(3)
(: 9 :)