caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Function call with a list of parameters
@ 2001-12-11 16:31 Vincent Barichard <Vincent Barichard
  2001-12-11 22:59 ` Chris Hecker
  2001-12-12  9:31 ` Jim Farrand
  0 siblings, 2 replies; 16+ messages in thread
From: Vincent Barichard <Vincent Barichard @ 2001-12-11 16:31 UTC (permalink / raw)
  To: caml-list


Hello,

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.

For example :
If I have the function
	 let fourAdd x y z w = x + y + z + w;;

I'll can execute it with the next command line :
	 myFunctionCall fourAdd [1 ; 2 ; 3 ; 4];;

The hypothesis are :
- The Arg1 function is in curried form and all its arguments have the same
type.
- The length of Arg2 is exactly the number of arguments needed by Arg1

I've tried the following code, but it doesn't work because the argument
nomProcedure has a different type at each call.

let rec runAlgoWithArgs nomProcedure liste_Args =
	match liste_Args with
		[] -> raise Exit
	|	[x] -> nomProcedure x
	|	x::xs -> runAlgoWithArgs (nomProcedure x) xs

Is anybody has an idea ??

Thanks for your help,

Vincent

-- 
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


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2001-12-17  7:40 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-11 16:31 [Caml-list] Function call with a list of parameters Vincent Barichard <Vincent Barichard
2001-12-11 22:59 ` Chris Hecker
2001-12-11 23:26   ` Bruce Hoult
2001-12-12  9:35   ` Markus Mottl
2001-12-12 10:20   ` Vincent Barichard <Vincent Barichard
2001-12-12 22:31     ` Diego Olivier Fernandez Pons
2001-12-13  0:20       ` Bruno Pagano
2001-12-13  0:17         ` Diego Olivier Fernandez Pons
2001-12-14 13:26           ` Alain Frisch
2001-12-17  7:40             ` Francois Pottier
2001-12-12 13:52   ` Francois Pottier
2001-12-12 18:54     ` Chris Hecker
2001-12-12 19:04       ` Patrick M Doane
2001-12-12 23:49       ` Bruce Hoult
2001-12-13  7:41       ` Francois Pottier
2001-12-12  9:31 ` Jim Farrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).