Re: Maps in exslt2?
"Vladimir Nesterovsky" <[email protected]> Wed, 17 Mar 2010 06:20:30 -0700
| Newsgroups | gmane.text.xml.xslt.extensions |
|---|---|
| Message-ID | <45b7a339$e838b45$45e6fdfc$@com> |
> >> I think it's really important to get some good data structures into > >> XQuery and XSLT 2.0. I've already written a read/black tree > >> implementation in pure XQuery 1.1 (using 1st class function closures) > >> which I was planning to release via EXPath when appropriate. > > > > That's good! Can I look at implementation? > > Sure - attached. Thanks. > > Technically, neither RB nor AVL trees need to know of key/value separation > > (they work with items). Key appears during search operation only. > > > > I've prefered to implement AVL tree as it allows to build a map with access > > by index, and by key at the same time. > > I've never needed to access a sorted map by index. I don't see what > you'd need that for except iterating the members of the map - and that's > definitely better done in a different way. Don't say never. There are tasks where you look at your data from two perspectives: as a map; as a random access (and update) list. Another thing is that AVL tree is slightly better balanced. -- Vladimir Nesterovsky http://www.nesterovsky-bros.com/