Skip to content

Instantly share code, notes, and snippets.

@emchateau
Created July 26, 2020 13:28
Show Gist options
  • Save emchateau/8a4647f1afdca629ad94eca5fb3c40b1 to your computer and use it in GitHub Desktop.
Save emchateau/8a4647f1afdca629ad94eca5fb3c40b1 to your computer and use it in GitHub Desktop.
Compare order of two sequences
(: https://codereview.stackexchange.com/questions/214571/xquery-compare-order-of-two-sequences :)
declare function local:testOrder2($baseSequence, $testSequence) {
let $positions := $testSequence ! index-of($baseSequence, .)
return min(for $pos at $index in tail($positions) return $pos - $positions[$index]) ge 0
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment