Author Archives: Dimitre Novatchev

Recursion with anonymous (inline) functions in XPath 3.0 — Part II

In my first post about implementing recursion with anonymous functions I provided the following example: let $f := function($n as xs:integer, $f1 as function(xs:integer, function()) as xs:integer ) as xs:integer {if($n eq 0) then 1 else $n * $f1($n -1, … Continue reading

Posted in Higher Order Functions, Performance Optimization, XPath 3.0 | 7 Comments

Word Ladders, or How to go from “angry” to “happy” in 20 steps

Acknowledgement: To Brandon, the person who attracted my attention to this problem. From Wikipedia, the free encyclopedia: A word ladder (also known as a doublets, word-links, or Word golf) is a word game invented by Lewis Carroll. A word ladder … Continue reading

Posted in Uncategorized | Leave a comment

Recursion with anonymous (inline) functions in XPath 3.0

A few days ago Roger Costello asked at the xsl-list forum: Hi Folks Is it possible to do recursion in an anonymous function? Example: I would like to implement an “until” function. It has three arguments: 1. p is a … Continue reading

Posted in Higher Order Functions, XPath 3.0 | Tagged , , | 6 Comments

Fizz Buzz with XPath 2.0/3.0

A few days ago Jim Fuller asked on Twitter: @xquery fizz buzz with xquery http://bit.ly/wC6Ra5┬ácan anyone come up with a faster version ? #xquery9:00 AM Feb 26, 2012 Here are my two answers in the categories: 1) Elegant; 2) Fast … Continue reading

Posted in Performance Optimization, XPath, XPath 3.0, XSLT 2.0, XSLT 3.0 | 3 Comments

The set datatype implemented in XPath 3.0

In my previous two posts I introduced the binary search tree datatype, implemented in XPath 3.0. In most cases the binary search tree operations find, insert and delete have efficiency of O(log(d)) and the print/serialize operation is O(N*log(d)), where d … Continue reading

Posted in functional data structures, XPath, XPath 3.0 | 2 Comments

Part 2: The Binary Search Data Structure with XPath 3.0, Deleting a node

In the first part of this post I presented a Binary Search Tree implemented in pure XPath 3.0. Some new nice features of XPath 3.0 were shown in action and other, still missing but very important features were identified and … Continue reading

Posted in functional data structures, XPath, XPath 3.0 | Leave a comment

The Binary Search Tree Data Structure–having fun with XPath 3.0

For a long time I have wanted to play with XSLT 3.0 and XPath 3.0. Despite these being in their WD status, the new features are so powerful and overwhelming. Take just these: Higher Order Functions and the ability to … Continue reading

Posted in functional data structures, XPath, XPath 3.0, XSLT 3.0 | 15 Comments