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] 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 (00:36)
From: Chris Hecker <checker@d...>
Subject: Re: [Caml-list] Currying in Ocaml

Let's start up the commuting labels discussion again!!!


I think you have to eta-expand:

(fun t d -> print_all d t)

I don't think there's a flip f x y = f y x in the pervasives library (why not, by the way, INRIA folks?), but it seems to be a common idiom, like fst and snd.

As for overhead, "Assume Nothing," as they say.  Try eta-expanding and let us know if you see a performance problem.


At 10:20 AM 6/8/01 +1000, Mark Wotton wrote:
>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?
>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

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