English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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 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