I have a wish for one of the future releases. I think that Mozart lacks some common data structures in the standard library. I think one of the most needed is a sorted associative container. Another such structure is a priority queue. I wonder why those did not make it into the Mozart's stdlib - I see it as a drawback for beginners who are used to C++'s or Java's stdlib.

Well, few people propose to contribute...

I think that there must be lots of reusable code out there. Maybe people are just too modest to contribute...?

To be constructive, I attach an implementation of sorted associative container that uses a red-black tree and a double-linked list (it is not as generic as could be, but could be enhanced easily).

I am a bit surprised by the way you use object features, because you use them as class features. (Some people even consider those features as a design mistake.) Why don't you use standard methods?

This way I expose similar interface as the Dictionary module, and the syntax is exactly the same (well, except the syntactic sugar available for dictionaries). I guess that I should provide a module rather than a class.

But I use this also regularly when I want to have a procedure (i.e. a "static method") inside a class, either because it uses some private identifiers (names) of the class, or just to logically group the code.

Cheers,
Filip

_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to