Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: Jim Farrand <jim@f...>
Subject: Re: [Caml-list] Function call with a list of parameters
On Tuesday 11 December 2001 16:31, you 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.

I'm not much of an OCaml expert, but I suspect that what you are trying to do 
is not possible.

Imagine that you had defined such a function, and want to call it like this:

> 	 myFunctionCall f l

What would be the type of f?  It depends on l:

If l is [],  f has type 'a

If l is [1], f has type int -> 'a

If l is [1; 2], f has type int -> int -> 'a


I don't think OCaml can properly type a function like you are describing.

Bug reports:  FAQ:
To unsubscribe, mail  Archives: