Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Vincent Barichard <Vincent Barichard <Vincent.Barichard@i...>
Subject: Re: [Caml-list] Function call with a list of parameters
Thank you, I'll try another way...

Vincent

Chris Hecker wrote:

> 
> >I'm trying to construct a function which take two arguments :
> >                Arg1 : a function, Arg2 : a list of parameters for the Arg1.
> >This function will call the function in Arg1 with Arg2 as parameters.
> 
> This is slightly related to a feature I'd like that's easy to do in lisp, but I don't think there's a way to do it in ML-style languages:
> 
> 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
> 
> g (? f ())
> 
> vs.
> 
> let x,y = f () in
> g x y
> 
> With lisp you can just "apply" and it works.  There's no way in caml to spread the arguments into a curried function application, however.
> 
> Chris
> 
> 
> -------------------
> 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

-- 
Vincent Barichard
Métaheuristiques et Optimisation Combinatoire
Faculté des Sciences d'Angers
Tel : 02 41 73 52 06
-------------------
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