Browse thread
[Caml-list] examples of heterogenous collections (containers ?)
- briand@a...
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | briand@a... |
| Subject: | [Caml-list] examples of heterogenous collections (containers ?) |
I'm embarking on that most typical of ewexamples, the heterogenous list.
So I have objects:
base_class
virtual method
derived_class_A
inherit base_class
derived_class_B
inherit base_class
...
And I would like to collect instances of derived_class_B,
derived_class_B etc.. into a data structure.
The obvious example is that I'd like to collect the objects into a
list and do something like :
List.iter
(f obj ->
obj#method)
list_of_objs
or is (obj :> base_class)#method ?
I've done quite a bit of searching but I cannot seem to find a "clean"
example of doing the above, just bits and pieces. Can anyone point me
to any examples or code ?
Thanks
Brian
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners