This module contains a function to calculate the factorial of any given non-negative whole number. The factorial is a textbook example of recursion.
- Version: 2.0
- XQuery Version: 3.1
- Namespace: http://marklogic.com/xdmp/math
This module contains a function to calculate the factorial of any given non-negative whole number. The factorial is a textbook example of recursion.
| (:~ | |
| : XQuery main module to demonstrate comments in XQDoc style | |
| : | |
| : @see: http://xqdoc.org/ | |
| : @see: https://github.com/xquery/xquerydoc | |
| : | |
| : @version 1.0 | |
| :) | |
| xquery version "1.0-ml"; |
| (:~ | |
| : XQuery library module to use higher order functions | |
| : | |
| : @version 1.0 | |
| :) | |
| xquery version "1.0-ml"; | |
| module namespace higher-order-functions = | |
| "http://www.example.org/xquery/functions/higher-order-functions"; |
| xquery version "1.0-ml"; | |
| module namespace test = "http://github.com/robwhitby/xray/test"; | |
| (: I assume you know what factorial looks like, if not, see: https://gist.github.com/3927580 :) | |
| import module namespace factorial = "http://marklogic.com/xdmp/math" at "/xqy/modules/factorial.xqy"; | |
| import module namespace assert = "http://github.com/robwhitby/xray/assertions" at "/xray/src/assertions.xqy"; | |
| declare function factorial-empty () { | |
| assert:equal( |
| <xsl:stylesheet | |
| xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
| version="2.0"> | |
| <xsl:template match="@*|node()"> | |
| <xsl:copy> | |
| <xsl:apply-templates select="@*|node()"/> | |
| </xsl:copy> | |
| </xsl:template> | |
| (:~ | |
| : XQuery main module to create URI Privileges in ML Security Database | |
| : | |
| : @version 3.1 | |
| :) | |
| xquery version "1.0-ml"; | |
| import module namespace sec="http://marklogic.com/xdmp/security" at "/MarkLogic/security.xqy"; | |
| declare variable $uri-stubs as xs:string* := |
| (:~ | |
| : XQuery main module to generate CSV file of Mark Logic Collections | |
| : Assumes collections lexicon is enabled for database | |
| : | |
| : @see: http://en.wikipedia.org/wiki/Comma-separated_values | |
| : @see: http://api.xqueryhacker.com/#cts:collections | |
| : @see: http://api.xqueryhacker.com/#xdmp:save | |
| : | |
| : @version 1.0 | |
| :) |
| (:~ | |
| : Function mapping is a very useful feature of Mark Logic | |
| : however, xdmp:xslt-invoke does not support function mapping | |
| : the functions in this library module | |
| : act as wrapper functions for xdmp:xslt-invoke | |
| : | |
| : @see: http://blakeley.com/blogofile/2012/03/19/let-free-style-and-streaming/ | |
| : @see: http://api.xqueryhacker.com/#xdmp:xslt-invoke | |
| : @see: http://www.w3schools.com/xsl/ | |
| : |
| (:~ | |
| : XQuery library module to convert strings using rotation cipher | |
| : | |
| : @version 2.0 | |
| :) | |
| xquery version "1.0-ml"; | |
| module namespace rotate-cipher = "http://marklogic.com/xdmp"; | |
| (: variable to store the base alphabet :) |