From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id D6A19BD73 for ; Tue, 16 Aug 2005 18:37:21 +0200 (CEST) Received: from pih-relay06.plus.net (fuzznuts.plus.net [212.159.14.133] (may be forged)) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j7GGbLIO023368 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Tue, 16 Aug 2005 18:37:21 +0200 Received: from [80.229.56.224] (helo=chetara) by pih-relay06.plus.net with esmtp (Exim) id 1E54RC-000352-Ey for caml-list@yquem.inria.fr; Tue, 16 Aug 2005 17:37:18 +0100 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Snd question Date: Tue, 16 Aug 2005 17:34:38 +0100 User-Agent: KMail/1.7.2 References: <161F0D30A699A84A8B7435B62BCE33B30360E19F@APS-MSG-01.southpacific.corp.microsoft.com> <43011A10.4090108@havenrock.com> <1124198264.13635.25.camel@localhost.localdomain> In-Reply-To: <1124198264.13635.25.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200508161734.38909.jon@ffconsultancy.com> X-Miltered: at nez-perce with ID 43021641.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocaml:01 ocaml:01 sml:01 ...:98 gripe:98 ...:98 frog:98 wrote:01 tuples:01 patterns:02 patterns:02 caml:02 linear:02 linear:02 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 On Tuesday 16 August 2005 14:17, skaller wrote: > match e with (h,t,...) -> My understanding is that the types of those expressions cannot expressed in= =20 the OCaml type system. So that would require quite a fundamental change. > because a tuple of all the same type is an array, > but as yet I haven't found a way to make ... work in > pattern matches. My only ellipses-related gripe is that ML patterns are designed to be linea= r=20 but it would be nice if they could perform all linear pattern matches.=20 Currently, you cannot match [|1; ...|] in OCaml. I believe the less-elegant solution "a when Array.length a > 1 && a.(0) =3D= 1"=20 will incur a significant performance penalty when used in the middle of a=20 large set of unguarded patterns. > It would actually be nice to have more general support > for polyadic tuple management: for example thinking about > obtaining a slice of a tuple, or concatenating two tuples, > suggests that just getting the n'th component is special case. =46rom my limited experience of SML, it is more of a pain than a benefit. =2D-=20 Dr Jon D Harrop, Flying Frog Consultancy Ltd. Objective CAML for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists