Jon Harrop wrote:
Actually I would say that your style is more useful than the built-in Set and
Map modules because you don't have to jump through hoops defining your
own "Int" module with its own "int" type and its own comparison function over
ints every time you want a set of integers. I would put the comparison
function in the set itself though.
IMHO, the Int module should be in the standard library, and the Set and
Map modules should have already instantiated sets and maps for the
standard base types (int, float, string, char).
Also, I'm not as down on functors as a lot of programmers seem to be.
While not perfect, they solve a number of problems very well. For
example, there are a number of operations on sets and maps which are
O(N) if and only if you know the two trees are in the same order, but
O(N log N) if you don't know they're in the same order. Functors lift
this check into the type system.
Brian
_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs