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 SAA26295; Wed, 8 Oct 2003 18:15:10 +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 SAA19283 for ; Wed, 8 Oct 2003 18:15:09 +0200 (MET DST) Received: from nemerle.org (lilith.ii.uni.wroc.pl [156.17.4.7]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h98GF8104282 for ; Wed, 8 Oct 2003 18:15:08 +0200 (MET DST) Received: from malekith by nemerle.org with local (Exim 4.24) id 1A7Gxv-0007nk-H5; Wed, 08 Oct 2003 18:15:07 +0200 Date: Wed, 8 Oct 2003 18:13:10 +0200 From: Michal Moskal To: Serge Cc: caml-list@inria.fr Subject: Re: [Caml-list] Constructors as functions and tuples in constructors Message-ID: <20031008161310.GA5102@roke.freak> Mail-Followup-To: Serge , caml-list@inria.fr References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i X-PGP-Fingerprint: CF89 1B14 11BE 1CC9 2CA3 7497 5E32 69B4 BC71 B4C2 X-Loop: caml-list@inria.fr X-Spam: no; 0.00; michal:01 moskal:01 malekith:01 pld-linux:01 caml-list:01 0400,:01 indirection:01 michal:01 moskal:01 malekith:01 kernel:01 int:01 int:01 constructors:01 constructors:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Wed, Oct 08, 2003 at 07:57:03PM +0400, Serge wrote: > > Gentlemen! Well, maybe there are some ladies here? :-) [...] > Second, it would also be nice not to have "the concept of constructor > arity", and treat the code below as correct: > > type t = A of int * int > let _ = > match A (17, 0) with > A z -> match z with (x, y) -> () Just need to use () after "of", like this: # type t = A of (int * int);; type t = A of (int * int) # let _ = match A (17, 0) with A z -> z;; - : int * int = (17, 0) # However constructing A of int * int takes one allocation (it's ), while A of (int * int) -- two (it's ). Referencing it also takes one indirection more. -- : Michal Moskal :: http://www.kernel.pl/~malekith : GCS {C,UL}++++$ a? !tv : When in doubt, use brute force. -- Ken Thompson : {E-,w}-- {b++,e}>+++ h ------------------- 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