> Thank you very much. Now I find that a mutable linked list can
> indeed be elegantly implemented in ocaml, e.g.:
>
> type 'a mlist = Empty | Node of 'a mlist ref * 'a ref;;
If efficiency is really crucial, you could also write
type 'a mlist = Empty | Node of 'a mcell
and 'a mcell = {mutable hd : 'a; mutable tl : 'a mlist}
You may have a look at the Caml FAQ, where the existence and
manipulation of pointers in Caml is discussed:
http://pauillac.inria.fr/caml/FAQ/pointers-eng.html
(Fresh english translation written for the occasion).
Best regards,
-- Pierre WeisINRIA, Projet Cristal, http://pauillac.inria.fr/~weis
This archive was generated by hypermail 2b29 : Thu Apr 13 2000 - 16:53:01 MET DST