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 OAA18148; Fri, 8 Jun 2001 14:15:32 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA18143 for caml-list@pauillac.inria.fr; Fri, 8 Jun 2001 14:15:31 +0200 (MET DST) 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 MAA15030 for ; Fri, 8 Jun 2001 12:10:00 +0200 (MET DST) Received: from gnome01.sovam.com (gnome01.sovam.com [194.67.1.179]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f58A9xL15218 for ; Fri, 8 Jun 2001 12:09:59 +0200 (MET DST) Received: from ts6-a25.Spb.dial.sovam.com ([195.190.96.25]:56962 "HELO kouzdra.glokaya" ident: "NO-IDENT-SERVICE[2]" whoson: "amoscal" smtp-auth: TLS-CIPHER: TLS-PEER: ) by gnome01.sovam.com with SMTP id ; Fri, 8 Jun 2001 14:09:29 +0400 Content-Type: text/plain; charset="koi8-r" From: Anton Moscal To: Mark Wotton Subject: Re: [Caml-list] Currying in Ocaml Date: Fri, 8 Jun 2001 14:13:39 +0400 X-Mailer: KMail [version 1.2] Cc: caml-list@inria.fr References: In-Reply-To: MIME-Version: 1.0 Message-Id: <01060812594101.02155@kouzdra.glokaya> Content-Transfer-Encoding: 8bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 8 Июнь 2001 04:20, Mark Wotton написал: > Is it possible to curry on arbitrary parameters in Ocaml, or is it > strictly left to right? I have a function "print_all depth tree" and > sometimes I'd like to curry on depth, other times on tree. I see that if i > write a little wrapper like "rev_curry_print_all tree depth = print_all > depth tree" I could curry using that instead, but this function is called > inside a deep recursive loop and I'm worried that I'll get an unnecessary > function call overhead. Is there a better way of doing this? You can achieve this effect by using labels in "commutiong labels mode" (compiler swtich -labels) let test ~a ~b = Printf.printf "a=%d b=%d\n" a b let testb = test ~a:1 let testa = test ~b:1 let _ = testb ~b:10; testa ~a:10 Regards, Anton ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr