From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id UAA05402; Wed, 29 Sep 2004 20:48:06 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA05253 for ; Wed, 29 Sep 2004 20:48:05 +0200 (MET DST) Received: from mproxy.gmail.com (rproxy.gmail.com [64.233.170.204]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id i8TIm4G9029098 for ; Wed, 29 Sep 2004 20:48:05 +0200 Received: by mproxy.gmail.com with SMTP id 77so3948413rnk for ; Wed, 29 Sep 2004 11:48:04 -0700 (PDT) Received: by 10.38.83.75 with SMTP id g75mr2390442rnb; Wed, 29 Sep 2004 11:48:03 -0700 (PDT) Received: by 10.38.75.19 with HTTP; Wed, 29 Sep 2004 11:48:03 -0700 (PDT) Message-ID: <7f8e92aa04092911481e72dbeb@mail.gmail.com> Date: Wed, 29 Sep 2004 21:48:03 +0300 From: Radu Grigore Reply-To: Radu Grigore To: caml-list Subject: [Caml-list] really HO Functions Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 415B0364.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; char:01 usefulness:01 ocaml:01 int:01 int:01 nested:02 widespread:03 widespread:03 iter:03 imperative:04 let:04 functions:05 functions:05 classify:05 functional:06 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk For this message I'll classify functions on "levels" based on how many nested parenthesis are needed to represent their type. Functions of level 0 (e.g. int -> int, char -> int -> int, ...) are the most used in programming. In widespread languages like C#, Java and C++ they are almost the only kind of functions used. Functions of level 1 (e.g. ('a -> 'b) -> ('b -> 'c) -> ('a -> 'c)) are used a lot when programming in a functional language. They are also the ones that appear in examples and tutorials written for imperative programmers. This category includes fold, iter, map, composition. However a language like OCaml allows N to go up as much as you want. My question is: are there functions of level >= 2 used in practice (e.g. (('a -> 'b -> 'a) -> 'a -> 'b list -> 'a) -> 'c)? 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)? One example of a level 2 function (stolen from a recent post by Jon Harrop) is this: let sum fold = fold (+);; regards, radu ------------------- 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