From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Phillip Lord Newsgroups: gmane.emacs.devel Subject: Re: dash.el [was: Re: Imports / inclusion of s.el into Emacs] Date: Tue, 12 May 2020 18:21:36 +0100 Message-ID: <873685dq73.fsf@russet.org.uk> References: <0c88192c-3c33-46ed-95cb-b4c6928016e3@default> <87wo5mc04t.fsf@fastmail.fm> <873686bbl5.fsf@russet.org.uk> <87d07963ec.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="9956"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.91 (gnu/linux) Cc: Joost Kremers , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue May 12 19:23:01 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 1jYYcO-0002RN-Nx for ged-emacs-devel@m.gmane-mx.org; Tue, 12 May 2020 19:23:00 +0200 Original-Received: from localhost ([::1]:46186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYYcN-0006J7-QW for ged-emacs-devel@m.gmane-mx.org; Tue, 12 May 2020 13:22:59 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57436) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYYbn-0005Us-Ch for emacs-devel@gnu.org; Tue, 12 May 2020 13:22:23 -0400 Original-Received: from cloud103.planethippo.com ([78.129.138.110]:42712) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYYbl-0001nj-Tn for emacs-devel@gnu.org; Tue, 12 May 2020 13:22:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=russet.org.uk; s=default; h=Content-Type:MIME-Version:Message-ID: In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=37zVWtAi8YidCyvY3lpnl+wwTATT4vZgeNoJxP1GEP4=; b=iEjTLQuYI5vUseM9vqSQD6+8M fN3++ASr6hDQCZjaVv2pcYay3yDjFFQDJ7NomDzebZhjGVcuwu0vWcgLYr7fPlhj+R80GNR9iS1NV AHX8GzWnrbFIUDy3AgRa5pgMzL6WCrkNrnx/XqQjsAeuVcU+dsBZeFhCKRgh8eFPbTlLK1q1DRd5j dwDToj7oR+3vBgKrBLi4fhAhSF6De7i1kzUAFdwH2kEpH1e/GNtgE9hwbVY6oHet9wpYVem5SH10S SIsh8XZTJl2v0WxTUFcv42BnXES7vvwJUgsFD+q3F/qrMD8ymnq0++Q7UzfKkrNWtafyOzjtGry7Q THcquZqyQ==; Original-Received: from cpc142652-benw12-2-0-cust953.16-2.cable.virginm.net ([82.21.43.186]:48632 helo=russet.org.uk) by cloud103.planethippo.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1jYYb3-0004Bo-Iy; Tue, 12 May 2020 18:21:37 +0100 In-Reply-To: (Stefan Monnier's message of "Tue, 12 May 2020 09:50:00 -0400") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cloud103.planethippo.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - russet.org.uk X-Get-Message-Sender-Via: cloud103.planethippo.com: authenticated_id: phillip.lord@russet.org.uk X-Authenticated-Sender: cloud103.planethippo.com: phillip.lord@russet.org.uk Received-SPF: none client-ip=78.129.138.110; envelope-from=phillip.lord@russet.org.uk; helo=cloud103.planethippo.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/12 13:21:38 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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:249999 Archived-At: Stefan Monnier writes: >> In Clojure, a function literal is written with `#(...)`, and it supports >> `%n` for arguments, where n=1,2,3... > > IIRC there's a macro somewhere providing a similar facility. > We can't use (# ...) because the reader doesn't like `#` on its own (it > expects it to be followed by something like a vector, a hex/binary/octal > number, etc...). It's not hard to do in a cheesy way. Implemented with dash.el, entirely from a sense of mischievousness. (defmacro fn (&rest args) (let ((argsd (--tree-map (cl-case it ('% 'x) (t it)) args))) `(lambda (x) ,@args))) Obviously this is not fully functional, but it works for the trivial example. (funcall (fn %) 10) (funcall (fn (+ 10 (/ % 2))) 50) I can't get it to work from first position though. So: ((lambda (x) x) 10) works, while ((fn %) 10) doesn't. Phil