From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: [External] : Closures - do you understand them well? Date: Thu, 8 Dec 2022 19:35:39 +0000 Message-ID: References: <87lenh7vrn.fsf@web.de> <87cz8t7qh5.fsf@web.de> <87mt7xpw7j.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21565"; mail-complaints-to="usenet@ciao.gmane.io" To: Michael Heerdegen , "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 08 20:36:16 2022 Return-path: Envelope-to: geh-help-gnu-emacs@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 1p3Mgp-0005Jb-3L for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 08 Dec 2022 20:36:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p3MgS-0005Of-A5; Thu, 08 Dec 2022 14:35:52 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p3MgN-0005OD-K8 for help-gnu-emacs@gnu.org; Thu, 08 Dec 2022 14:35:47 -0500 Original-Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p3MgL-00027T-7v for help-gnu-emacs@gnu.org; Thu, 08 Dec 2022 14:35:47 -0500 Original-Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2B8HhlpL000806; Thu, 8 Dec 2022 19:35:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2022-7-12; bh=ghDE9LyA4036rKRCGG6qGSYtIueXt+vYdQSvRbgu3yY=; b=G56qNG0wa531WU8BsDwqJi2PUL6sA5Bi3k4wk584BqhqJ+z4bXby7c1L/vmwlASkXuNn XO7htGUPZAc5fShrhZvU3+FA1eNBRbTb8cKzkuk7iV3Bb2Uvt9GxjBySf063igSQggwP vpg7wCkcfW7LLGOk17ExYr7W20ellaRmisUOK2DGOdmemiForRbYWyvl+VpxhUnjPbB2 bRFUIonRnwJSvdoebu3g5li+DEwKirb4hpGpOEqmmKDxDbZeTz4rx7n7qxnkI3jEagOG 3D+JBDQaEAQZHYc+ZQUrb5trr2B5+1yTobo3YIOc5sVqs4voX+rLhFdkUzOUCT6faaSw BA== Original-Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3maud73rdj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 08 Dec 2022 19:35:42 +0000 Original-Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2B8IG4TU034515; Thu, 8 Dec 2022 19:35:41 GMT Original-Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2044.outbound.protection.outlook.com [104.47.74.44]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3maa4sh7aj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 08 Dec 2022 19:35:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YCsnGwr0oDK278OfVJ9tYtXZ/uqTUqIrBS6qaGEThqzTrUfc0GMq0y3GZOYN1kpODwTgRNBCThqIRydVb7QcN/L/kPaHHEKPT0+LD7Qk0SiGgcdDVbIBJ8Qsudu8OIETZ4A4JbVdzsMkGaRnwoykbCu/OUG6AoeWt1l0xtCsEihoFlbHzEsNPTOYbu5fEcGYTfagjj7ndjdQMUcL3xcrVN3wha9swp02vJsEeZdIEuTNvQXidqX04pGQ6Tamoo6mXf0xng8+sh9JGmPqOXEAnfa0sEo2Kc9L2ylmAza8VzLywNZq9krBBHpi54wIwL/yvogrKyP43iJiYnY+WIogdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ghDE9LyA4036rKRCGG6qGSYtIueXt+vYdQSvRbgu3yY=; b=DvYY9etZXmQu63Wmc/EywmpKPGffqrEj3ROd1dK3J3y9Ek99A7hrk74CUVMSJRolWWWJm7AQlxAQNVXP86zrIXzGiP8m2mPWJNNnZOoFW889AgJ5axtNmpDHNWcBzBocNxZtN10UDqGDFBP6MewqBcLDV4niqRN5ldNhyScPLeJkYfvnTRbt5eAMDwFNyELOc2uziA5rHc3OucKpGLXXQExHYUFhtYVlSlOmdY+YfIWsbmCG3nMHncwQJMOQ0GbtjMuQwP5DS5lPGhqt3JQFOH2tXDUOHzx96FfDhS6ia8omYW2x6fyOjQyZoPuKWrTHGEgNhJwCSanlBvbiE77Tew== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ghDE9LyA4036rKRCGG6qGSYtIueXt+vYdQSvRbgu3yY=; b=SN4k83K+QJlXJcX3UNzVciCgN71VUSzEAIoZ3Z0G/9QSegpGu5ShAyxPH6U5mBDGtkCyqdDfKy5eA+WtiZe6+zz7fb2pXccEjpeXYWMT73GXc2tqtp7lUlFspT0Qj7gAk8DX/4NSYDMmfN332E1skJCK65/3Is+KRRXzwxKTIEM= Original-Received: from SJ0PR10MB5488.namprd10.prod.outlook.com (2603:10b6:a03:37e::19) by BL3PR10MB6116.namprd10.prod.outlook.com (2603:10b6:208:3bb::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14; Thu, 8 Dec 2022 19:35:39 +0000 Original-Received: from SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::176d:3689:aa5b:91b]) by SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::176d:3689:aa5b:91b%2]) with mapi id 15.20.5880.014; Thu, 8 Dec 2022 19:35:39 +0000 Thread-Topic: [External] : Closures - do you understand them well? Thread-Index: AQHZCzXu2gq/q8ckwUKcLdDmm4DT365kXTKg In-Reply-To: <87mt7xpw7j.fsf@web.de> Accept-Language: en-US Content-Language: en-US x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SJ0PR10MB5488:EE_|BL3PR10MB6116:EE_ x-ms-office365-filtering-correlation-id: d8ea5e64-cf50-4d90-e4ba-08dad9536302 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: xLbHkzgNn71EZI98pjBug8nuMFbXNWbMEuwqH6POxCH3X3mSS7sjfc97SMYhHk5us41A7JG6BIQYGfKLBAOJgIKlQpkGJv2ocFGU9aSCc7yuUiKTvUnRowkgKhiUr6V4NaSkyfOAmt9aXT3fQkRLPdpZMnSnChF1i4B1w9N8fBbW925nKtyzU8XxlVyqxW2gTm7ppfm9b8uyaUe71U7PJa46V3vZmTvHwHrKuJe+DSCGnnnWhN2quCX1e0lztSj4fOaO66faG8Wq7iJ5JFY7Rm5Tej+AI5HC/p/xAO0VM7AojbXG1rzE1+lz7KXPZ2AUbJpVCUY7lUP9U8GuI5+9L2JHGr0pFIikKhYmWUMwxWsxE++zGKIDjR1rrGyxC4fN3h4oGozciZqbCc3HO5F4vT+51NNsYW2j/JWaEk+ew+hafSUsU1mQs64ehs4l1R0EggO6Togw0NSx8Qo9f6iOpNlKnwEwOn/Ta+yMa3nXf5xdKOLToYp40a6/AQNhkG3q/d9oT8rR1u+xVmxjo1oywr2iPRW5rhv4S2I70boO6FZ+KH/Pttq+GmYvfHuANFSIIr9t82Cd07K7YL0cpi8h0WjNkvX3pDHW+fnvwHc0LDIl2H8rAH2u8/EEFULkpXrz8mMP8/VQMAQwXKMDOduWMW7jkxesCmwZaUSmPtZZ/HNMCC3RdPiX5uMesDfn2wq/QytDi5vGgfJ/Twf6941jsTSTyGfIerM0saZr/kh8UPXna8vrqgfY949sOF2QX PLl0xXEGA1PLuyWTTQy5QXKuw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR10MB5488.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(396003)(39860400002)(136003)(346002)(366004)(451199015)(66446008)(76116006)(5660300002)(83380400001)(64756008)(52536014)(8936002)(8676002)(66946007)(41300700001)(38100700002)(122000001)(2906002)(44832011)(33656002)(55016003)(26005)(66476007)(66556008)(38070700005)(9686003)(6506007)(86362001)(7696005)(186003)(71200400001)(110136005)(316002)(966005)(478600001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?ytsYtCoWBMsGCP51uVXP/eBfeaJ5XKCHOcX5gacqMTCDWXAGZoTPAL4chxtJ?= =?us-ascii?Q?7yldO4wq7w0LU7v+BgP6h9FPexPmyuRv1keDOjtsJJn+M8llqUrNj+L1eYIx?= =?us-ascii?Q?d4kmf7DN5OB6IRlRWCmBauJFBUXrClJ6GxoemMjerKupn9aSFK6Ba2MfbK6G?= =?us-ascii?Q?VGh9Itlu9yMLYCg39hs/8GCaZCIaVBENzKPXCVH//JpiDBGrWgEbddbw8Pbt?= =?us-ascii?Q?tM7nStei4koI+iKJlen/hxyXB3SV6ssSeS39gf/PV0yyUWTeGW7CnmbTnytP?= =?us-ascii?Q?mfLO002RhOV1qleQwMmlioH/p9t+A7jSc4KE/O6aZ57npNKvW6dZtL0EQ0Cj?= =?us-ascii?Q?vZJkpT/sHDdHii7D5ho1o5znwW5u6NDYEkTEw1Kik+nzlgmajG0JRkwZteW6?= =?us-ascii?Q?BWYjQ4EXccdyLeGA1wHAqlNgU4Y2xpBQilalTxAscC6W5mFZnLSihM6cGy8H?= =?us-ascii?Q?r6If09uO9aGBRaC0ULhcIhMXEH7THph5WyezwPmebuluLz5jsa3qGIsQYPjz?= =?us-ascii?Q?DZGY9hd8ndcc8mrLEJKSHeQoQ3kc9mFZYyqPumY758hTOWjE45Qedx86Jfhx?= =?us-ascii?Q?mIT2qFMxHGmEm4lXVo4GhOZS2Ns5yZ0Dr9rsXrn+DmLRA/xB9D/ryY1w13Al?= =?us-ascii?Q?zf X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5488.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d8ea5e64-cf50-4d90-e4ba-08dad9536302 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Dec 2022 19:35:39.2524 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: qPI6sR2wky7seomDVtsNooQKMQMnHtgYaX9CDDyIxlhaAi9n1jS8ECk2IpFeN29Z9P8p3jTw8y1x7m8OMAionw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR10MB6116 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-08_11,2022-12-08_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=827 suspectscore=0 mlxscore=0 spamscore=0 adultscore=0 bulkscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2212080164 X-Proofpoint-GUID: VwKo7sOdR9NAhlcRKx9SHr_94CwGZWnC X-Proofpoint-ORIG-GUID: VwKo7sOdR9NAhlcRKx9SHr_94CwGZWnC Received-SPF: pass client-ip=205.220.165.32; envelope-from=drew.adams@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URI_DOTEDU=1.331 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:141467 Archived-At: > When the reader encounters "()" I expect it to construct an empty list. > That's what I want, so I quote it to get exactly that when that > expression is evaluated. >=20 > If we do not limit ourselves to Emacs Lisp, the (not trivial) question > would else be: what is the return value when evaluating an empty list? > Not trivial because there can be Lisps where an empty list and a boolean > "false" are different (AFAIR such Lisps exist). Scheme. As CLTL2 says at the outset: https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node9.html#SECTION0052200000= 0000000000 In Common Lisp, as in most Lisp dialects, the symbol ^^^^^^^^^^^^^^^^^^^^^^^^ nil is used to represent both the empty list and the ``false'' value for Boolean tests. An empty list may, of course, also be written (); this normally denotes the same object as nil.... These two notations may be used interchangeably as far as the Lisp system is concerned. However, as a matter of style, this book uses the notation () when it is desirable to emphasize the use of an empty list, and uses the notation nil when it is desirable to emphasize the use of the Boolean ``false''. The notation 'nil (note the explicit quotation mark) is used to emphasize the use of a symbol. For example: (defun three () 3) ;Emphasize empty parameter list=20 (append '() '()) =3D> () ;Emphasize use of empty lists=20 (not nil) =3D> t ;Emphasize use as Boolean ``false''=20 (get 'nil 'color) ;Emphasize use as a symbol Any data object other than nil is construed to be Boolean ``not false'', that is, ``true''. The symbol t is conventionally used to mean ``true'' when no other value is more appropriate. When a function is said to ``return false'' or to ``be false'' in some circumstance, this means that it returns nil. However, when a function is said to ``return true'' or to ``be true'' in some circumstance, this means that it returns some value other than nil, but not necessarily t. (Note that the second example does what you do. (Of course at this point in the book there's been no mention of t and nil/() being self-evaluating.) https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node57.html#SECTION009110000= 00000000000 > Because I don't want to tangent this question I prefer > to quote the empty list. What are your reasons to > prefer to evaluate it and use the result? No reason not to do that, i.e., no reason to quote it. =20 Why not emphasize and take advantage of the fact that=20 (always) '() =3D ()? No more reason to quote it than there is (in Elisp, unlike in Common Lisp) to quote a lambda expression (not speaking about #' "quoting" here).