Created
February 17, 2018 08:32
-
-
Save line-o/1ce8c6ae3e6e6cce30db1b4ee6ec22f0 to your computer and use it in GitHub Desktop.
An example of fold-left, filter and for-each in combination.
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
| xquery version "3.1"; | |
| declare function local:gta50 ($a, $b) { $a > $b}; | |
| declare function local:add22 ($a) { $a + 22}; | |
| declare function local:sum ($result, $next) {$result + $next}; | |
| declare variable $local:sequence := (1,32,34,3,34) | |
| util:log('info', string-join($local:sequence, ',')), | |
| fold-left( | |
| filter( | |
| for-each( | |
| $sequence, | |
| local:add22#1 | |
| ), | |
| local:gta50(?, 50) | |
| ), | |
| 0, | |
| local:sum#2 | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment