Skip to content

Instantly share code, notes, and snippets.

@derickson
Created May 4, 2012 01:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save derickson/2591084 to your computer and use it in GitHub Desktop.
Save derickson/2591084 to your computer and use it in GitHub Desktop.
Learning XQuery 2
(: I assume local mathematical functions
functionA, functionB, and functionC are
defined above :)
(: this is too procedural :)
let $accumulator := 1
let $accumulator := functionA($accumulator)
let $accumulator := functionB($accumulator)
let $accumulator := functionC($accumulator)
return
$accumulator
(: now you're thinking with functions :)
functionC( functionB( functionA( 1 )))
(: maybe more maintainable,
especially when IF and FLWOR statements
get mixed in :)
functionC (
functionB (
functionA (
1
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment