Version franaise
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] OCaml Speed for Block Convolutions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-06-08 (12:15)
From: Anton Moscal <msk@p...>
Subject: Re: [Caml-list] Currying in Ocaml
 8  2001 04:20, Mark Wotton :
> Is it possible to curry on arbitrary parameters in Ocaml, or is it
> strictly left to right? I have a function "print_all depth tree" and
> sometimes I'd like to curry on depth, other times on tree. I see that if i
> write a little wrapper like "rev_curry_print_all tree depth = print_all
> depth tree" I could curry using that instead, but this function is called
> inside a deep recursive loop and I'm worried that I'll get an unnecessary
> function call overhead. Is there a better way of doing this?

You can achieve this effect by using labels in "commutiong labels mode" 
(compiler swtich -labels)

let test ~a ~b = Printf.printf "a=%d b=%d\n" a b

let testb = test ~a:1
let testa = test ~b:1

let _ = 
  testb ~b:10;
  testa ~a:10

Regards, Anton
Bug reports:  FAQ:
To unsubscribe, mail  Archives: