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 OAA10086; Wed, 12 Dec 2001 14:52:55 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA10203 for ; Wed, 12 Dec 2001 14:52:54 +0100 (MET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id fBCDqrH15307 for ; Wed, 12 Dec 2001 14:52:54 +0100 (MET) Received: (from fpottier@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA10238 for caml-list@inria.fr; Wed, 12 Dec 2001 14:52:53 +0100 (MET) Date: Wed, 12 Dec 2001 14:52:53 +0100 From: Francois Pottier To: caml-list@inria.fr Subject: Re: [Caml-list] Function call with a list of parameters Message-ID: <20011212145253.A10180@pauillac.inria.fr> Reply-To: Francois.Pottier@inria.fr References: <15382.13531.184819.989958@helios.info-ua> <4.3.2.7.2.20011211145019.028d8e50@arda.pair.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Mailer: Mutt 1.0i In-Reply-To: <4.3.2.7.2.20011211145019.028d8e50@arda.pair.com>; from checker@d6.com on Tue, Dec 11, 2001 at 02:59:22PM -0800 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, Dec 11, 2001 at 02:59:22PM -0800, Chris Hecker wrote: > I have a function that returns a tuple, and a function that takes two > curried parameters. I'd like to pass the results of the first to the > second, without having to break up the tuple with fst and snd (or pattern > matching). > > let f () = (1,2) > let g x y = x + y The usual solution is as follows: # let uncurry g (x,y) = g x y;; val uncurry : ('a -> 'b -> 'c) -> 'a * 'b -> 'c = # uncurry g (f());; - : int = 3 -- François Pottier Francois.Pottier@inria.fr http://pauillac.inria.fr/~fpottier/ ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr