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 KAA03917; Tue, 6 Mar 2001 10:53:10 +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 KAA04143 for ; Tue, 6 Mar 2001 10:53:09 +0100 (MET) Received: from mta5.snfc21.pbi.net (mta5.snfc21.pbi.net [206.13.28.241]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f269r8b15111 for ; Tue, 6 Mar 2001 10:53:08 +0100 (MET) Received: from checkerlap.d6.com ([64.160.53.238]) by mta5.snfc21.pbi.net (Sun Internet Mail Server sims.3.5.2000.01.05.12.18.p9) with ESMTP id <0G9R00HAGS4NOI@mta5.snfc21.pbi.net> for caml-list@inria.fr; Tue, 6 Mar 2001 01:38:52 -0800 (PST) Date: Tue, 06 Mar 2001 01:39:33 -0800 From: Chris Hecker Subject: [Caml-list] currying... X-Sender: def6@shell16.ba.best.com To: caml-list@inria.fr Message-id: <4.3.2.7.2.20010306012957.00c7cf00@shell16.ba.best.com> MIME-version: 1.0 X-Mailer: QUALCOMM Windows Eudora Version 4.3.2 Content-type: text/plain; charset="us-ascii" Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk How does caml know when to call a function? For example, say I have: val f: int -> int -> int -> unit and the definition of f is let f x y = Printf.printf "%d %d" x y;Printf.printf "%d" so f actually takes two ints, prints them, and then returns a function that takes an int and returns unit. From the val declaration above in a .cmi file, how can caml tell the difference between that f and this one: let f x y z = Printf.printf "%d %d %d" x y z How does it know "when" to call f, since you need a different number of parameters for the different definitions? The top f prints x y when it's called with two parms, so it doesn't wait until all three parms have been passed. I have a feeling I'm missing something fundamental here, or else the definition of a function internally has a field for its arity and it just partially applies until it reaches the total arity. I thought I remembered seeing some documentation on this months ago, but I can't find it now... It doesn't seem to partially evaluate the function or anything insane like that. Chris ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr