From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= Newsgroups: gmane.emacs.devel Subject: Re: humble proposal: New special form progn-1 Date: Wed, 27 Jul 2016 10:08:32 -0400 Message-ID: <3d003b0a-6d60-1081-5a6f-6324add22e79@gmail.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="GweqKNUHUeg1m7WFxilkS9v7Csg9Ljrdu" X-Trace: ger.gmane.org 1469628547 28681 80.91.229.3 (27 Jul 2016 14:09:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Jul 2016 14:09:07 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jul 27 16:08:57 2016 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 1bSPW3-0007XC-4l for ged-emacs-devel@m.gmane.org; Wed, 27 Jul 2016 16:08:55 +0200 Original-Received: from localhost ([::1]:46719 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSPW2-0001bb-6E for ged-emacs-devel@m.gmane.org; Wed, 27 Jul 2016 10:08:54 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49429) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSPVv-0001bS-S2 for emacs-devel@gnu.org; Wed, 27 Jul 2016 10:08:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSPVq-00010v-LM for emacs-devel@gnu.org; Wed, 27 Jul 2016 10:08:46 -0400 Original-Received: from mout.kundenserver.de ([212.227.126.130]:50217) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSPVq-00010V-6u for emacs-devel@gnu.org; Wed, 27 Jul 2016 10:08:42 -0400 Original-Received: from [128.31.34.159] ([128.31.34.159]) by mrelayeu.kundenserver.de (mreue002) with ESMTPSA (Nemesis) id 0MAHYP-1bZKSH1v5N-00BJvp for ; Wed, 27 Jul 2016 16:08:40 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 In-Reply-To: X-Provags-ID: V03:K0:xzz+37IgkAbs+FuVtE/RgmqPTk3RJF5tG+r5yehWg+Hxrk6gPSD 22zvfk21Oq86qT6qyVsZ7n7CRMQ7g/v7xQT32xpO2JodFZ7zJP36/q1Mup+QqjHFxGz4CUl wloGttE9L2PxSIk+efoMw/23qNKgRyt+p8OgFHK4ABv6o4lUlkb2Rb9UoiiagWh3u9vpuE0 VO+vITozU3fmHsG3YDPMQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:KyVJHQQCqJI=:5+KtubhSm9/Xl5n5CZX+8o ahMm70KnR1czP00rGXJ+X6Ev2De2UN8NBOVvp5xMyvi4f3613Me8x9LzZowSXzGmJfdwTRznD oOCLBh9JiF7AuAriLe2n4FxMkTv/Eq/g876wfWlG0/WJxOiEYDaWJRD4MBDBZKbAcYij/npff Zo6gzeSszs+ioxfJlK2aa+V1I658SespBqPzQhee32tqX4dgh/5XSmerzeaRt7cn1kkvrEg1B xOE6IEnlKBQNS21hmx3J76VUXWv8IYrxSeVsjzIx/c3D/G9ue80uMTONeaQbWDK5B3nRSvce9 Su8zM1Uto7dLyGgFBN1Re8b1i+aASvdh8HPXd5kVRgq4tehssGsSmvkgs3cql9v85NaXXih4a mjnXNIVHvejp0TXPwRWIlOs3ocNGdKZDaBfH9WpQB8at0VojJmysaG6TZ1dkyF1B/Z4gfISFh DBvRkRU+IQP3MGsyUgOSIyuLsRioy1j0fNf720ixLcAV05zg1fS6An2IWT7UhVo7D6Ldivov6 Wyu2AIU343TXIn8B864/gCcaDKLkgF8XdCt9cYz9MpTp+9J1Pw8EtU034R94OQ5dFbSNe1/77 x8jsgi4O3s7SBD55G/c7EA48XEYxmW6RrS5FePdKfQwnYYxMxnaEzjE+mZ3B8dlAM0Hp3P77G UTmSVhavdIDMS2mMABq1+6/VYVl2jPnyH7WHr8gPSrA961uokWtCXYcnFpnzQRHfjLrk= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.130 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:206180 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --GweqKNUHUeg1m7WFxilkS9v7Csg9Ljrdu Content-Type: multipart/mixed; boundary="AKrCcuI54oBhJM8RVGsotGa0WB2EqCJnG" From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= To: emacs-devel@gnu.org Message-ID: <3d003b0a-6d60-1081-5a6f-6324add22e79@gmail.com> Subject: Re: humble proposal: New special form progn-1 References: In-Reply-To: --AKrCcuI54oBhJM8RVGsotGa0WB2EqCJnG Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 2016-07-27 08:16, Tino Calancha wrote: > Dear all, >=20 > i got this idea few days ago (see the patch at the end). >=20 > Even though I envision that no one here will like this proposal, > for me it's instructive to learn from your answers why this is > not a good idea. :) I don't have anything strongly against it myself. Any reason to not ma= ke it a lisp macro though? > My (weak) motivation for introduce this is: >=20 > * Compact (and familiar) syntaxis. > * Same reasons to exists as prog2 has (excluding historical reasons). > * Other way to acomplish one usual task. > * Allow lower indentation level (see below): Sounds good. One worry that I have with the name is that I read it as (pr= ogn)-(1), not prog(n-1). But in any case, maybe it would be best to make it a lisp macro first? > ... > (prog2 > (progn > (form1) > (form2) > (form3) > . > . > . > (formN-2)) > (prog1 > (formN-1) > (formN))) Wouldn't=20 (progn=20 (form1) ... (formN-2) (prog1 (formN-1) (formN))) work? Cheers, Cl=E9ment. > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;= ;;;;;;;; >> From c9b38c42b253ca004c3aef4dd9dde274aa717d91 Mon Sep 17 00:00:00 2001= > From: Tino Calancha > Date: Wed, 27 Jul 2016 20:40:25 +0900 > Subject: [PATCH] New special form progn-1 >=20 > * src/eval.c (progn-1): Eval sequentially N forms and > return the value of the form N-1. > --- > src/eval.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) >=20 > diff --git a/src/eval.c b/src/eval.c > index 33b82f7..5eb0cfd 100644 > --- a/src/eval.c > +++ b/src/eval.c > @@ -431,6 +431,23 @@ usage: (progn BODY...) */) > return val; > } >=20 > +DEFUN ("progn-1", Fprogn_1, Sprogn_1, 2, UNEVALLED, 0, > + doc: /* Eval N forms sequentially; return value from form N-1. > +usage: (progn-1 FORM_1 FORM_2...FORM_N-1 FORM_N) */) > + (Lisp_Object body) > +{ > + Lisp_Object val =3D Qnil; > + > + while (CONSP (XCDR (body))) > + { > + val =3D eval_sub (XCAR (body)); > + body =3D XCDR (body); > + } > + eval_sub (XCAR (body)); > + > + return val; > +} > + > /* Evaluate BODY sequentially, discarding its value. Suitable for > record_unwind_protect. */ >=20 > @@ -3906,6 +3923,7 @@ alist of active lexical bindings. */); > defsubr (&Sif); > defsubr (&Scond); > defsubr (&Sprogn); > + defsubr (&Sprogn_1); > defsubr (&Sprog1); > defsubr (&Sprog2); > defsubr (&Ssetq); --AKrCcuI54oBhJM8RVGsotGa0WB2EqCJnG-- --GweqKNUHUeg1m7WFxilkS9v7Csg9Ljrdu Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXmMBlAAoJEPqg+cTm90wjpEoP/iEtAXU0RpPKfwZf13FWoQxW rpxlfTTZTvQFcT4FcJfbHdtUtZr1HOw9Qs0+xo+V0f+Z7SC7YnNSEiqK3SNzf6HR J1L9Ya7ToET+fw4FyVyTYuiucuosqTh5bAn5SdjYeGWijITbqVEQPqeJPW93lGEB 3Lj2GI8YofyAHK1cEOhXJNTrFz2FewrMtPjQS11NrXFe4u9IJ+9eHMrZeTMnjo4d 7RimGKYcgMCS6HIXR6txC9b24C/CJ68v2iOgl504S00Qu3exl78XZJc+elpzufqi NWeEPElosgjRKfGbNoLEtUzQawJY0N1w7D3Z9oHCP9/2wvB4QjxTeeQsqRMpR1Gy g1nJ8ZmTRcY7NdZOanAt7RY3/kxYvfXGW6QBwDAYIAF1D42KtS1UACF6e18SvNo6 1UsxUOWvRIkCfn3b273Da6lYt/yNjLTlZHjeFEhvyjAr3RkrEtwV4ET73cX7Wf/o GbnLlW75H1IuMhEPVCM33VjfEa580VnIkrt3/P2QY87K0UV5cA8oX1p7HitGlJd2 UVQ3IyykwoIzYs/iZE0M2xgIvDYxHSvX+522C8ZoVjYAJw6Rlhq00hleOaCsDvQB CJtlMvNl93NGdICfVMNvCJoJHuIDUZcuHhl2AGB8IYZNH7Qdhkmem75ayvC/zvsV d0Z56iJwInCsM2elWRQp =sGkb -----END PGP SIGNATURE----- --GweqKNUHUeg1m7WFxilkS9v7Csg9Ljrdu--