Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] examples of heterogenous collections (containers ?)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-03-31 (04:55)
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:

  virtual method

  inherit base_class

  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 :

  (f obj ->

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  ?



To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: