Playing with Higher Order Functions in XQuery
✓ Published0🌍 Public
CCliffordAnderson
Last edited Mar 3, 2015
Created on Mar 3, 2015
This example demonstrates how higher-order functions in XQuery 3.1 enable function composition for transforming numeric sequences. It shows a square function (`$map-sqr`) that uses the simple map operator (`!`) with `math:pow`, which is then fed into a reversal function (`$pow-rev`) via the `=>` arrow operator. The code applies `fn:reverse` to the input sequence before passing it to the squared map, returning the squares of the reversed order. The rendered output is computed in-memory with no external data source, purely exercising the language’s functional capabilities.
AI-generated description