Quicksort in XQuery
✓ Published0🌍 Public
CCliffordAnderson
Last edited Nov 25, 2015
Created on Nov 22, 2015
This visualization compares four XQuery implementations of the quicksort algorithm, each derived from a Haskell reference, to demonstrate functional programming in a query language. It shows how the same recursive sorting logic can be expressed with different XQuery 3.1 features, including `fn:head()`, `fn:tail()`, `position()`, and a random-number generator for permutation. The code uses `local:qsort` functions with `xs:integer*` sequences, and the final example applies the sort to a shuffled list of 1 to 100 generated via `fn:random-number-generator('permute')`. The display highlights syntactical variations, such as explicit `where` clauses versus nested `if` expressions, without altering the core algorithm.
AI-generated description