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 VAA07523; Wed, 29 Sep 2004 21:23:14 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA07513 for ; Wed, 29 Sep 2004 21:23:13 +0200 (MET DST) Received: from cgpsrv2.cis.mcmaster.ca (univmail.CIS.McMaster.CA [130.113.64.46]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id i8TJNCvP026072 for ; Wed, 29 Sep 2004 21:23:13 +0200 Received: from [130.113.68.27] (account carette@univmail.cis.mcmaster.ca HELO pccarettej) by cgpsrv2.cis.mcmaster.ca (CommuniGate Pro SMTP 4.1.8) with ESMTP id 66814167; Wed, 29 Sep 2004 15:23:11 -0400 Reply-To: From: "Jacques Carette" To: "'Radu Grigore'" , "'caml-list'" Subject: RE: [Caml-list] really HO Functions Date: Wed, 29 Sep 2004 15:24:50 -0400 Organization: McMaster University Message-ID: <000a01c4a659$fd2f9270$1b447182@cas.mcmaster.ca> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Importance: Normal In-Reply-To: <7f8e92aa04092911481e72dbeb@mail.gmail.com> X-Miltered: at concorde with ID 415B0BA0.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; jacques:01 caml-list:01 okasaki:01 higher-order:01 okasaki:01 combinator:01 jacques:01 2004:99 caml-list:01 char:01 usefulness:01 bug:01 faq:01 faq:01 beginner's:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk The best answer is from Chris Okasaki in Even Higher-Order Functions for Parsing or Why Would Anyone Ever Want To = Use a Sixth-Order Function? by Chris Okasaki. Journal of Functional = Programming, 8(2):195-199, March 1998. Abstract: We illustrate the use of third-, fourth-, fifth-, and even sixth-order functions with examples taken from a combinator parsing = library. Available at http://www.eecs.usma.edu/Personnel/okasaki/jfp98.ps Jacques -----Original Message----- From: owner-caml-list@pauillac.inria.fr [mailto:owner-caml-list@pauillac.inria.fr] On Behalf Of Radu Grigore Sent: September 29, 2004 2:48 PM To: caml-list Subject: [Caml-list] really HO Functions 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 >=3D 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 =3D 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 ------------------- 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