From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.6.10/8.6.6) id NAA16617 for caml-redistribution; Fri, 20 Oct 1995 13:24:44 +0100 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.6.10/8.6.6) with ESMTP id QAA20604 for ; Thu, 19 Oct 1995 16:17:29 +0100 Received: from margaux.inria.fr (margaux.inria.fr [128.93.8.2]) by concorde.inria.fr (8.6.10/8.6.9) with ESMTP id QAA07020 for ; Thu, 19 Oct 1995 16:17:28 +0100 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by margaux.inria.fr (8.6.10/8.6.6) with ESMTP id QAA11059 for ; Thu, 19 Oct 1995 16:17:28 +0100 Received: from victor.labri.u-bordeaux.fr (root@victor.labri.u-bordeaux.fr [147.210.8.168]) by concorde.inria.fr (8.6.10/8.6.9) with SMTP id QAA07016 for ; Thu, 19 Oct 1995 16:17:27 +0100 Received: from waves (waves.labri.u-bordeaux.fr) by victor.labri.u-bordeaux.fr (4.1/SM-mailhost-BORDEAUX-1.0) id AA13919; Thu, 19 Oct 95 16:24:13 +0100 Received: from localhost by waves (4.1/SM-BORDEAUX0.1) id AA04207; Thu, 19 Oct 95 16:16:11 +0100 Message-Id: <9510191516.AA04207@waves> From: Andrew Conway Reply-To: arc@labri.u-bordeaux.fr To: caml-list@margaux.inria.fr Subject: Re: [Q]: Mutable variant types in Caml Light 0.7 In-Reply-To: Your message of "Thu, 19 Oct 1995 11:31:13 +0100." <9510191031.AA19481@gr6> Date: Thu, 19 Oct 1995 16:16:10 +0100 Sender: weis Christian Boos wrote: > ... >Si ce raisonnement est correct, une amélioration pourrait alors être >effectuée, permettant de cumuler efficacité et souplesse : > - soit une grosse refonte de la syntaxe des types, pour avoir des >déclarations à la SML (mais plus expressives, en raison du 'mutable') : > > type t = A of { a:int; mutable b:float; c:string; } > > - soit en faisant une modification sur la syntaxe de l'extension 3.6 >permettant d'avoir des types "union" mutables : > > type t = A of int * (mutable float) * string Moi aussi! Why I would like it? Well, although I generally like strictness, sometimes lazy lists are useful. So I decided to make some lazy list routines. I used the following type: type 't lazylist = EndLL | Element of 't llcont | Unconstructed of (unit -> 't lazylist) and 't llcont = { value : 't ; mutable next : 't lazylist} ;; The trouble is that takes 5 words per evaluated element, whereas with Christian's suggestion it could be done in 3 words like normal lists, as well as avoiding the ugliness in the above type definition. Neither are huge things for me, but since it has already been suggested, I second it. ( Incidentally, is there a nicer basic structure for lazy lists? ) Thanks again, Andrew.