Continuing with the post "Ongoing xslt/xquery spec update" we would like to articulate what options regarding associative containers do we have in a functional languages (e.g. xslt, xquery), assuming that variables are immutable and implementation is efficient (in some sense).
There are three common implementation techniques:
Implementation choice considerably depends on operations, which are taken over the container. Usually these are:
Note that modification in a functional programming means a creation of a new container, so here is a division:
On the other hand to deal with container's modifications one can build an implementation, which uses "top-down" RB or AVL trees. To see the difference consider a classical tree structure and its functional variant:
node parent left right other data
node left right other data
Here we observe that:
Here we provide a C# implementation of a functional AVL tree, which also supports element indexing:
Our intention was to show that the usual algorithms for associative containers apply in functional programming; thus a feature complete functional language must support associative containers to make development more conscious, and to free a developer from inventing basic things existing already for almost a half of century.
Remember Me
a@href@title, b, blockquote@cite, em, i, strike, strong, sub, super, u