From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Joost Kremers Newsgroups: gmane.emacs.devel Subject: Re: dash.el [was: Re: Imports / inclusion of s.el into Emacs] Date: Tue, 12 May 2020 09:03:39 +0200 Message-ID: <87d07963ec.fsf@fastmail.fm> References: <0c88192c-3c33-46ed-95cb-b4c6928016e3@default> <87wo5mc04t.fsf@fastmail.fm> <873686bbl5.fsf@russet.org.uk> Mime-Version: 1.0 Content-Type: text/plain; format=flowed Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="109950"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.4.4; emacs 27.0.91 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue May 12 09:06:48 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jYP03-000SV7-Iw for ged-emacs-devel@m.gmane-mx.org; Tue, 12 May 2020 09:06:47 +0200 Original-Received: from localhost ([::1]:37914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYP02-00043X-IC for ged-emacs-devel@m.gmane-mx.org; Tue, 12 May 2020 03:06:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53464) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYOx6-0008Nq-F0 for emacs-devel@gnu.org; Tue, 12 May 2020 03:03:44 -0400 Original-Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:56641) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYOx5-0007QL-3J for emacs-devel@gnu.org; Tue, 12 May 2020 03:03:44 -0400 Original-Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 7570E54A for ; Tue, 12 May 2020 03:03:41 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 12 May 2020 03:03:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= references:from:to:subject:in-reply-to:date:message-id :mime-version:content-type; s=fm3; bh=eiU0hbYj6E9MIPlDl0bqWPKTKE /ZN4fJYcbpTci7Bs0=; b=s+hLBPf5K053u8++2Lz+iB7QM5KcqWJBEs2afSqYdq KGEK1xCxXjIyURGzsIN7JPDu0SoYzM2OK9i6c55ApvIAB6Llnpi0Ah9c7IZy3QGC f0vzlIbup12TKWPxH9Sc23CQ2qG0vl/eCIfL9/c4ngVMzpkTscG+SJwXBpgs+g7j fogP2+Q/le0AqyZLMJtGLQu8CHIhYtyAne7V1VqImcFLjAzwAxrzWWFSYxSzR0iv 7UGpRrM0kOX31ybYQ2ybevIm6rChVeag+afufrw+r0wStNin2d3XODRYDfV5NLPA tsuUfsjulsc7ENCbNFWUgQrmMjUTyRea0h+fQNvvNNGg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=eiU0hb Yj6E9MIPlDl0bqWPKTKE/ZN4fJYcbpTci7Bs0=; b=U2VMt/UO9CAAX9NGTqbPKZ KSVbfyC/JPPwdx12VfG+piB2VYlh17SLBBbCpuKQTfE17LVqWFpqIjaD8+kHtgk3 qeBfvrHwKjCB0CFDh+lUd55OXvpzbj4eW0HLlL+WDSqtKH11ojEQQcvFoDVDzfOn qAjyWcTr3Lqzcoiq3Jhht+2shUTYBywKNAO+Xz29xzdYJNazP8ILOiQcNlH1ksiC CwtBxMkcWmjgrwsGoTI2NG7L/zbGWiiA1UCXBenGSz8+fqxSiK/hfsU6toZjDqT5 ytD5rGH+zUOJhE56i7gAV7QJ3UZIVf+alL+7zRRs0rbByiYpiv4GjB5HMetD0rmQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrledugdduudegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpehffgfhvffujgffkfggtgesthdtre dttdertdenucfhrhhomheplfhoohhsthcumfhrvghmvghrshcuoehjohhoshhtkhhrvghm vghrshesfhgrshhtmhgrihhlrdhfmheqnecuggftrfgrthhtvghrnhepheekudfgkefhfe dtvedtiefhgfegudejteetteeuveefgffggffgudelteeuleehnecuffhomhgrihhnpegt lhhojhhurhgvrdhorhhgnecukfhppeelhedrledtrddvtddurdeivdenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjohhoshhtkhhrvghmvghr shesfhgrshhtmhgrihhlrdhfmh X-ME-Proxy: Original-Received: from Lenovo.fastmail.com (ip5f5ac93e.dynamic.kabel-deutschland.de [95.90.201.62]) by mail.messagingengine.com (Postfix) with ESMTPA id B0DD13280066 for ; Tue, 12 May 2020 03:03:40 -0400 (EDT) In-reply-to: Received-SPF: pass client-ip=64.147.123.25; envelope-from=joostkremers@fastmail.fm; helo=wout2-smtp.messagingengine.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/12 03:03:41 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:249946 Archived-At: On Tue, May 12 2020, Richard Stallman wrote: > > (map #(/ % 2) '(2 4 6 8)) > > > It's quite neat (the % being the equivalent of dash.el's > > `it`). > > In Lisp we have always preferred to write things in the more > general > form where you specify the arg names. But a shorter construct > which avoid the need to specify the arg names might be ok. In Clojure, they're called function literals and the Clojure docs say "[...] idiomatic use would be for very short one-off mapping/filter fns and the like." So basically just what you said. > What could that kind of abbreviated lambda-expression look like? In Clojure, a function literal is written with `#(...)`, and it supports `%n` for arguments, where n=1,2,3... (Actually, I don't know if Clojure supports `%10` and up or if it just goes up to `%9`, but I guess that doesn't matter much). A single `%` is synonymous with `%1`, which is used when there's only one argument. Also supported is `%&`, which is similar to `&rest ` in Elisp, being bound to a list containing the remaining arguments. That's all there is to it (the official doc is ever shorter: fourth bullet point under ). -- Joost Kremers Life has its moments