[Caml-list] How to add () to function parameters

2009-10-16 Thread Till Crueger
Hi, I am looking for a way to add a unit parameter to a function that takes an arbitrary number of parameters. If the number of parameters is known this is fairly easy and I can just do: let lift1 f a = fun () -> f a;; let lift2 f a b = fun () -> f a b;; (all these create

Re: [Caml-list] How to add () to function parameters

2009-10-16 Thread Till Varoquaux
Well I can basically see two solutions (plus countless complications that I won't go into.) We want to define a function val cps3: f:('a -> 'b -> 'c -> 'd) -> ('d -> 'e) -> 'a -> 'b -> 'c -> 'e = that takes a three argument function a returns the same function in CPS style. The functional unpar

Re: [Caml-list] How to add () to function parameters

2009-10-16 Thread Till Varoquaux
Oh, and I nearly forgot: In practice you shouldn't really have that many functions taking more than 5 unlabeled arguments lying around so I would bite the bullet and define cps1 through 5 the straightforward way Till On Fri, Oct 16, 2009 at 11:15 AM, Till Varoquaux wrote: > Well I can basica