From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA32337; Thu, 2 May 2002 11:42:37 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA32333 for ; Thu, 2 May 2002 11:42:36 +0200 (MET DST) Received: from nef.ens.fr (nef.ens.fr [129.199.96.32]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g429gZX01610; Thu, 2 May 2002 11:42:35 +0200 (MET DST) Received: from clipper.ens.fr (clipper-gw.ens.fr [129.199.1.22]) by nef.ens.fr (8.10.1/1.01.28121999) with ESMTP id g429gZa26034 ; Thu, 2 May 2002 11:42:35 +0200 (CEST) Received: from localhost (frisch@localhost) by clipper.ens.fr (8.9.2/jb-1.1) id LAA20807 ; Thu, 2 May 2002 11:42:35 +0200 (MET DST) Date: Thu, 2 May 2002 11:42:35 +0200 (MET DST) From: Alain Frisch To: Francois Pottier cc: caml-list@inria.fr Subject: Re: [Caml-list] Extensible tuple types In-Reply-To: <20020502093435.C27687@pauillac.inria.fr> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thu, 2 May 2002, Francois Pottier wrote: > On Tue, Apr 30, 2002 at 04:42:01PM +0200, Jocelyn Sérot wrote: > > > > Sorry to jump in the middle of this discussion, but your last remark on > > "extensible > > n-tuples" drew my attention (i use to need this kind of thing in a > > completely different > > context). Can you provide references on these extensions of ML type > > systems ? > > Tuples can be viewed as records whose field labels are integers, rather than > names. (In particular, this means that tuple fields do not commute, contrary > to record fields.) Records can be typed in a flexible way using rows; see > Didier Rémy's papers, for instance ``Type Inference for Records in a Natural > Extension of ML''. In the case of tuples, it's possible to use a variant of > rows -- I'll call them ``sequences'' -- to describe an infinite sequence of > types. I don't understand what this encoding of extensible tuples allows, compared to the simple minded solution [the type of an n-typle is (t1,(t2,...(tn,unit)...)) ] > The operation which accepts any tuple, of length at least k, and returns > its k-th component, has type > > forall 'a_1, ..., 'a_k, 's. > ('a_1; ...; 'a_{k-1}; Present('a_k); 's) -> 'a_k fun (x1,(x2,...(xk,_)...)) -> xk > The operation which accepts any tuple and adds a new component in front > of it has type > > forall 'a, 's. > 'a -> ('s) -> (Present('a); 's) fun x c -> (x,c) -- Alain ------------------- 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