[xquery-talk] map module for XQUERY ?

John Snelson john.snelson at marklogic.com
Tue Dec 3 03:31:04 PST 2013


On 03/12/13 11:27, jean-marc Mercier wrote:
>  > XQuery comes from the world of database
> I understand this point. From another side, it could be used to write
> complex algorithmic : I found this language very handy to that purpose,
> because it is a functional language, it is incredibly data flexible, and
> template programming is straightforward. Provided basic containers were
> added, the community could enrich this language with external modules,
> best among them could in turn feed the standardization process. At
> present time, as far as I understand, the only way to write a serious
> algorithm is to bind XQUERY with an external imperative language, that
> is not really a good solution.

You can create a simple linked list using a cons cell:

declare function local:cons($head,$tail)
{
   function() { $head, $tail }
};

declare function local:to-list($seq)
{
   if(empty($seq)) then () else
     local:cons(head($seq),local:to-list(tail($seq)))
};

John

-- 
John Snelson, Lead Engineer                    http://twitter.com/jpcs
MarkLogic Corporation                         http://www.marklogic.com


More information about the talk mailing list