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] really HO Functions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-09-29 (22:35)
From: Jon Harrop <jon@j...>
Subject: Re: [Caml-list] really HO Functions
On Wednesday 29 September 2004 19:48, Radu Grigore wrote:
> My question is: are there functions of level >= 2 used in practice
> (e.g. (('a -> 'b -> 'a) -> 'a -> 'b list -> 'a) -> 'c)?

I've just had a look through some real programs that I've written and the 
answer is definitely yes. I use them quite a lot. For >2 they are mainly 3, 
sometimes 4 and I haven't seen any >4.

> If so, are 
> there any typical ones that appear in many applications (maybe not as
> widespread like map & company but at least of comparable usefulness)?

I seem to use them when I write generic functions which are later specialised.

> One example of a level 2 function (stolen from a recent post by Jon
> Harrop) is this:
>   let sum fold = fold (+);;

Funny to think that this function is still state-of-the-art Java and C++. ;-)


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