Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] mutually referencing compilation units
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Quetzalcoatl Bradley <qbradley@b...>
Subject: [Caml-list] function polymorphic in number of arguments?

Is it possible to make a function of N arguments (3 or more), the first 
two are functions of N-2 arguments, and the function calls the first 
two functions passing its remaining arguments to each of the first two 
functions.  For example

let f1 x = print_string (x ^ "1\n");;
let f2 x = print_string (x ^ "2\n");;

let f a b x = ??? What goes here ???

f f1 f2 "abc";;

result in

abc1
abc2

The trick part is I want the same function f to work if I pass it f1 
and f2 of 2 arguments and pass 4 arguments to f, f1, f2, and two others 
that get passed to f1 and f2.

Thanks for your time,

Quetzalcoatl Bradley
qbradley@blackfen.com
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners