From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Clojure-like syntactic sugar for an anonymous function literal Date: Sun, 25 Jan 2015 10:33:47 +1100 Message-ID: <874mrfwy78.fsf@building.gnus.org> References: <54C05269.7050602@dancol.org> <87oaprfa3t.fsf@fencepost.gnu.org> <54C0C514.8020606@dancol.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1422142474 11834 80.91.229.3 (24 Jan 2015 23:34:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 24 Jan 2015 23:34:34 +0000 (UTC) To: "emacs-devel\@gnu.org" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jan 25 00:34:34 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YFADm-0002Cg-T2 for ged-emacs-devel@m.gmane.org; Sun, 25 Jan 2015 00:34:31 +0100 Original-Received: from localhost ([::1]:36395 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFADm-0001Si-7E for ged-emacs-devel@m.gmane.org; Sat, 24 Jan 2015 18:34:30 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47177) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFADi-0001SN-EH for emacs-devel@gnu.org; Sat, 24 Jan 2015 18:34:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFADf-0006IG-70 for emacs-devel@gnu.org; Sat, 24 Jan 2015 18:34:26 -0500 Original-Received: from hermes.netfonds.no ([80.91.224.195]:48035) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFADf-0006El-0y for emacs-devel@gnu.org; Sat, 24 Jan 2015 18:34:23 -0500 Original-Received: from [27.96.197.126] (helo=building.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1YFADF-0007mx-SF for emacs-devel@gnu.org; Sun, 25 Jan 2015 00:33:58 +0100 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAMFBMVEVHicja5eT///7///9M jspNjbx0epFilcZimMyrq7YLDQ5BdrExPFpDh8dWlMlWltBDJEBgAAABWElEQVQ4jcXUL27DMBQG cIPSgSQo0C4azS4wENyRBVWKNGKpUunU3aBBm5JIld4FBnKFaheYCnqBsWGPFi17z//mJC0a2Kcq qb+fHYNYYTcXwv4bhBtk+uegjgF4nDb8OuKpSGshLOxWACBXIOVOSsBLYyESQkQi5hEXHP8KPrcg ARpck0I93DyLAHAX4OnDCIRLLILMWbYZ5MneE5btKW8fo7QaJrWFScsMBIXPFcKwnM3yPL9lzMGR yvw3LNFwHLYUDcdJbQAfbEe9Sf6pwU2/632UUgQ0fxHUff+tgXr11U9h2lu4zxdK+e5UVS+0iQZl AUsbA7iAnlUFeSYolYZTCNuNA1UNe4JiAlvzaotyBO6dF3oJHgM/24OVMI8GyhAUFsWy1aAXmXux 1Mdp39pzFeZA8XAI8t51HYIfd2EQurP5M7zKtZQriRnDei0PhARwNsnFL8MPu3QqLeJkL3kAAAAA SUVORK5CYII= X-Now-Playing: burn's _304 (Moon Base Big)_: "Wire!Red_Barked_Tree!01-Please_Take" In-Reply-To: <54C0C514.8020606@dancol.org> (Daniel Colascione's message of "Thu, 22 Jan 2015 01:38:28 -0800") User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) X-MailScanner-ID: 1YFADF-0007mx-SF MailScanner-NULL-Check: 1422747238.89831@yhlyukkcBFlefGa6i6UNUA X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.224.195 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:181735 Archived-At: Daniel Colascione writes: >> The most popular library in MELPA, https://github.com/magnars/dash.el, >> implements it (for a long time) like this: >> >> (--map (* it it) '(1 2 3)) >> ;; => (1 4 9) >> >> With my approach, it's: >> >> (mapcar #(* % %) '(1 2 3)) >> ;; => (1 4 9) > > With idiomatic elisp, it's > > (mapcar (lambda (x) (* x x)) '(1 2 3)) > > Both alternatives above are more esoteric than the lambda form and are > approximately as wrong. Note how the "lambda" is a prominent "I AM A > FUNCTION" signal. I don't like it either, but perhaps it's a good idea anyway? 1) I really like the way that Lisp has a culture of making explicit bindings. Naming variables helps a lot with reading comprehension, which is a pretty important thing. In these toy examples it doesn't make much difference, but that's not how real code looks like. In real code you have ten-line lambdas with the "%" appearing on the second-to-last line, and you will have forgotten what that "%" refers to when you reach that line. And the forms are awfully kludgey, since they don't really nest that well. 2) The Kids These Days really love this way of writing code. I mean, kids have always loved write-only obfuscatory code, but they seem to have really glommed on to this idiom of implicit parameters in closures. Perhaps part of that is just that there are so many programmers forced to work in the Java industry, and they only have the choice of working with the dreary drudgery of actual Java code, the incomprehensibility of Scala, and the (in comparison) sanity of Clojure. And the Clojure peeps really like that style, it seems. So to make Emacs Lisp more attractive to the incoming locust of Clojure programmers, perhaps we should accommodate that by adding these forms? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog http://lars.ingebrigtsen.no/