From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=AWL,SPF_SOFTFAIL autolearn=disabled version=3.1.3 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 2AF2ABB84 for ; Wed, 13 Aug 2008 13:04:52 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiADAIBcokip5TxXiGdsb2JhbACRdgEBAQ8gnVCHAkCBVQ X-IronPort-AV: E=Sophos;i="4.32,201,1217800800"; d="scan'208";a="13962318" Received: from gateway0.eecs.berkeley.edu ([169.229.60.87]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Aug 2008 13:04:51 +0200 Received: from [10.0.1.5] (136-152-208-53.VPN.Berkeley.EDU [136.152.208.53]) (authenticated bits=0) by gateway0.EECS.Berkeley.EDU (8.14.3/8.13.5) with ESMTP id m7DB4Sv7029049 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Wed, 13 Aug 2008 04:04:29 -0700 (PDT) In-Reply-To: <1C96BA4C-8E65-44AA-96CD-C1CA399635E2@cs.berkeley.edu> References: <9E2C98C8798A487DAE77F20A9DC4F1E8@countertenor> <7C6C7ADD-910D-4C62-92FF-E286F0817FA1@cs.berkeley.edu> <1C96BA4C-8E65-44AA-96CD-C1CA399635E2@cs.berkeley.edu> Mime-Version: 1.0 (Apple Message framework v753.1) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <71757DE7-4C78-4151-9E7A-84C63EDF4A74@cs.berkeley.edu> Cc: OCaml List Content-Transfer-Encoding: 7bit From: Brighten Godfrey Subject: Re: [Caml-list] Value shadowing (tangent) Date: Wed, 13 Aug 2008 04:04:29 -0700 To: David Allsopp X-Mailer: Apple Mail (2.753.1) X-Spam: no; 0.00; ocaml:01 subjective:01 wrote:01 wrote:01 readable:01 caml-list:01 let:03 let:03 berkeley:04 styles:08 fun:08 fun:08 curious:09 compact:09 actually:10 On Aug 13, 2008, at 3:49 AM, Brighten Godfrey wrote: > Going off on a tangent here... > > On Aug 13, 2008, at 2:56 AM, David Allsopp wrote: >> >> let lst = [5; 4; 3; 2; 1; 0; -1; -2; -3; -4; -5] >> in >> let filter = List.filter (fun x -> x > 0) >> in >> let double = List.map (fun x -> -2 * x) >> in >> let sort = List.sort compare >> in >> (sort $$ double $$ filter) lst > > I've seen little of other people's OCaml code, so out of curiosity, > do you or others actually write code formatted like the above, as > opposed to the more compact and (I think) readable > > let lst = [5; 4; 3; 2; 1; 0; -1; -2; -3; -4; -5] in > let filter = List.filter (fun x -> x > 0) in > let double = List.map (fun x -> -2 * x) in > let sort = List.sort compare in > (sort $$ double $$ filter) lst > > ? P.S. Sorry David, on second read I sounded pretty elitist there! I realize this is all subjective and my habits are no more valid than others'. I am curious, though, what styles people have adopted. Thanks, ~Brighten