Created
May 4, 2012 01:31
-
-
Save derickson/2591084 to your computer and use it in GitHub Desktop.
Learning XQuery 2
This file contains 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
(: 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 |
This file contains 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
(: now you're thinking with functions :) | |
functionC( functionB( functionA( 1 ))) |
This file contains 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
(: 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