Skip to main content
100%

Example of Fib

✓ Published0🌍 Public
CCliffordAnderson
Last edited Aug 10, 2017
Created on Aug 10, 2017

This example contrasts two XQuery 3.1 implementations of the Fibonacci sequence, both computing the 30th term. The first defines a recursive function with a `switch` statement, while the second uses tail recursion with accumulator parameters. Each script uses the `declare function` syntax to expose `local:fib`, returning an `xs:integer` sequence. The example highlights alternative recursion strategies in XQuery, showing how the same mathematical result can be produced through different control-flow patterns without external libraries or visualizations.

AI-generated description

Similar vizzes