English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Function call with a list of parameters
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-12-13 (10:56)
From: Markus Mottl <markus@o...>
Subject: Re: [Caml-list] Function call with a list of parameters
On Tue, 11 Dec 2001, 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 uncurry f (x, y) = f x y

> let f () = (1,2)
> let g x y = x + y
> g (? f ())

  uncurry g (f ())

Markus Mottl

Markus Mottl                                             markus@oefai.at
Austrian Research Institute
for Artificial Intelligence                  http://www.oefai.at/~markus
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