Version française
Home     About     Download     Resources     Contact us    
Browse thread
When functional languages can be accepted by industry?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pierre Weis <Pierre.Weis@i...>
Subject: Re: When functional languages can be accepted by industry?
> 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 Weis

INRIA, Projet Cristal, http://pauillac.inria.fr/~weis