The first question you should ask is *why*: in my experience, there's
hardly ever a reason to do this, since it's very difficult to write
code which can make any use of the mixed types in your list.  Usually
there is some other structure you can use which will capture what you
are trying to do.  (Hint: your data types should match the structure
of your code.)

If this is truly what you need, you can accomplish this using
universal types.  There is a good page here on implementing UTs in
SML; translation to OCaml is fairly straightforward:
http://mlton.org/UniversalType

- Chris

On Sun, Dec 26, 2010 at 12:30 PM, Ivo Seeba <[email protected]> wrote:
> I need a list, or other structures, that enables insert elements of
> different types.
> I need a list like [("A",3);("B",[2;3;4]);("A",[[3;4];[1;2]])];.
> or like
> let st = ref ();;
> let insert b = (st:=(b,!st));;
> insert ("A",3);;
> insert ("B",[1;2]);;
>
> or.
>
> let st = ();;
> let insert b = ( let st = (b,st) );;
> ..
> Can anybody help me?
> --
> All the best and a happy new year: Ivo
>
> --
> You received this message because you are subscribed to the Google Groups
> "ocaml-developer" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/ocaml-developer?hl=en
> For other OCaml forums, see http://caml.inria.fr/resources/forums.en.html

-- 
You received this message because you are subscribed to the Google Groups 
"ocaml-developer" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/ocaml-developer?hl=en
For other OCaml forums, see http://caml.inria.fr/resources/forums.en.html

Reply via email to