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-12 (09:33)
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: 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