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 LAA04595; Tue, 6 Mar 2001 11:17:40 +0100 (MET) 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 LAA01380 for ; Tue, 6 Mar 2001 11:17:39 +0100 (MET) Received: from chamber.cco.caltech.edu (chamber.cco.caltech.edu [131.215.48.55]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f26AHcb16398 for ; Tue, 6 Mar 2001 11:17:38 +0100 (MET) Received: from granicznt (granicz.cs.caltech.edu [131.215.44.167]) by chamber.cco.caltech.edu (8.9.3/8.9.3) with SMTP id CAA23407 for ; Tue, 6 Mar 2001 02:17:36 -0800 (PST) Reply-To: From: "Adam Granicz" To: Subject: RE: [Caml-list] currying... Date: Tue, 6 Mar 2001 02:16:31 -0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk it does evaluate it partially. you have to remember that functions are first-class values as well. as a matter of fact, the formally declared parameters do not really matter, they are resolved by the compiler by looking at the body of the function. declaring formal parameters is only necessary when the order of these parameters can not be unambigously determined. thus let neg = function true -> false | false -> true is automatically understood as val: neg: bool -> bool. also, remember that ocaml functions take only one parameter, so val f: int -> int -> int -> unit is actually the composition of several functions, the first taking an int and returning a unit, the second taking an int and returning an int, and so on. > so f actually takes two ints, prints them, and then returns a > function that takes an int and returns unit. From the val this one would be val f: int -> int -> (int -> unit) anyway, as to your question: if enough arguments are supplied so that the function can be evaluated, then it is called and returns whatever that function was supposed to return. however, if not all arguments were given then the function is only partially evaluated with all known parameters. let f i j = i+j f 1 returns a function that expects one argument, so let g = f 1 and g 2 return 3. hope this helps.. adam. ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr