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 TAA03811; Thu, 23 Aug 2001 19:07:00 +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 TAA03588 for ; Thu, 23 Aug 2001 19:06:59 +0200 (MET DST) Received: from beaker.balestra.org (ip20.gte2.rb1.bel.nwlink.com [209.20.176.20]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f7NH6sX02905 for ; Thu, 23 Aug 2001 19:06:58 +0200 (MET DST) Received: (from bradym@localhost) by beaker.balestra.org (8.11.2/8.11.2) id f7NH6mA27082; Thu, 23 Aug 2001 10:06:48 -0700 To: caml-list@inria.fr Subject: [Caml-list] Style question: excessive currying confusion? From: Brady Montz Date: 23 Aug 2001 10:06:48 -0700 Message-ID: User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk [ I posted this to comp.lang.ml a few weeks ago, before I found this list ] Howdy ya'll. I'm a long time C and lisp programmer who's taken on learning CAML for real. I played with ML a bit a few years ago in grad school. So I'm working through lots of CAML code now, and I find code which "excessively" uses currying to be a bit hard to read. I'm curious if this gets better with practice, and if anyone has some good style rules about this. So, here's an extremely simple example: let fun1 x y z = [ x; y; z];; let fun2 x = fun1 (x + 1);; (* alternative implementation of fun2 *) let fun3 x y z = fun1 (x + 1) y z;; Suppose I'm reading through someone else's program, and I come across the definition for fun2, and I want to know what it does. I can't even know how many parameters fun2 takes until I refer to the definition of fun1. The confusion is worst when I don't even know I'm confused about the number of args fun2 can take. Now, in most cases I've hit the confusion would have been much lessened with proper function naming and commenting, but not always. Now, on the other hand, there are times when currying is obviously great. For example, if it is really important to me that fun2 always have a similar signature to fun1, then this seems fine to me. Also, there is benefit to keeping the code succinct. So, anyhoo, if anyone has helpful advise to this ML newbie, I'd much appreciate it. -- Brady Montz bradym@balestra.org ------------------- 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