From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Oleh Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Clojure-like syntactic sugar for an anonymous function literal Date: Thu, 22 Jan 2015 11:22:42 +0100 Message-ID: References: <54C05269.7050602@dancol.org> <87oaprfa3t.fsf@fencepost.gnu.org> <877fwfunnz.fsf@uwakimon.sk.tsukuba.ac.jp> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1421922184 26120 80.91.229.3 (22 Jan 2015 10:23:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 22 Jan 2015 10:23:04 +0000 (UTC) Cc: "emacs-devel@gnu.org" To: "Stephen J. Turnbull" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jan 22 11:23:04 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 1YEEul-0003Ix-5K for ged-emacs-devel@m.gmane.org; Thu, 22 Jan 2015 11:23:03 +0100 Original-Received: from localhost ([::1]:52165 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEEuk-0003T0-Jf for ged-emacs-devel@m.gmane.org; Thu, 22 Jan 2015 05:23:02 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55148) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEEuT-0003Pv-Tn for emacs-devel@gnu.org; Thu, 22 Jan 2015 05:22:46 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YEEuR-00020y-PB for emacs-devel@gnu.org; Thu, 22 Jan 2015 05:22:45 -0500 Original-Received: from mail-wi0-x231.google.com ([2a00:1450:400c:c05::231]:58877) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEEuR-00020Y-J4 for emacs-devel@gnu.org; Thu, 22 Jan 2015 05:22:43 -0500 Original-Received: by mail-wi0-f177.google.com with SMTP id r20so2187003wiv.4 for ; Thu, 22 Jan 2015 02:22:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=jguIHUV5J6zZ9hedv9EwAcNq4byjoSCQw4Ou3PVX2zo=; b=Cgtaa5Zwf4i64ANltgJoS9nWFIyjBCA6eVmZ4P8Oq2UStSJixGqvfPpCawLdwRAh4l EEuFQcDewDELiXKZW4JaaecVwg563mqXOp66WCff76A4EejNbPswG4G6qK1qXIJRJDuA MinHXb0kmgStymGHAI+2fWSbp6S0Q4wZMbZiZ5xsHHhYmPRz/zQt2Q8hkXJ0NxB1wsUC mOHEi72G14ZeJ+s4AzYfPHGbWENecUs4q63bS0M31+s88yimPMj5iIioTiDLdz2wPcmU oHOy8q/Me3Y8faP1NADnj/gc/30H1CLsSFhGuT+9vq5duE17HUNnl1/jBAY3HPzgxFuW zwMg== X-Received: by 10.181.12.11 with SMTP id em11mr65876153wid.1.1421922162771; Thu, 22 Jan 2015 02:22:42 -0800 (PST) Original-Received: by 10.27.137.137 with HTTP; Thu, 22 Jan 2015 02:22:42 -0800 (PST) In-Reply-To: <877fwfunnz.fsf@uwakimon.sk.tsukuba.ac.jp> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::231 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:181580 Archived-At: > > 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) > > That looks almost like Perl! Now I'm -2. Just require dash. How is `dash' better? `--map' is a macro: (defmacro --map (form list) "Anaphoric form of `-map'." (declare (debug (form form))) `(mapcar (lambda (it) ,form) ,list)) `dash' also gives other ~40 macros that look like this, littered all over the code in the MELPA, so it's impossible to go on without understanding what `dash' does. On the other hand, `mapcar' is a C function. It and all other functions can use `short-lambda' instead of being reimplemented as macros on a case-per-case basis by `dash'.