Last active
April 30, 2025 17:08
-
-
Save line-o/848b970f7043c6f67da55308d0641abb to your computer and use it in GitHub Desktop.
Highlight some hard to handle edge-cases in fn:chain since the arity of functions is set but return sequences can vary in size
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let $xml := | |
<root> | |
<child>1</child> | |
<child>2</child> | |
<child>3</child> | |
<!--<child>4</child>--> | |
</root> | |
let $children := fn ($n) { $n/child } | |
return ( | |
chain($xml/root, ( | |
$children, | |
fn ($a, $b, $c) { concat($a, $b, $c) } | |
)), | |
chain($xml/root, ( | |
$children, | |
tail#1, | |
fn ($a, $b, $c) { concat($a, $b, $c) } | |
)), | |
chain($xml/root, ( | |
$children, | |
concat#2 | |
)), | |
chain($xml/root, ( | |
$children, | |
apply(concat#3, ?) | |
)) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment