From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.help Subject: Re: function arguments optional default values Date: Thu, 04 Jul 2024 00:04:58 +0200 Message-ID: <87v81mcet1.fsf@gmx.net> References: <87zfqycffj.fsf@gmx.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21508"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Heime via Users list for the GNU Emacs text editor To: Heime Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jul 04 00:05:35 2024 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 1sP86Z-0005PX-CJ for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 04 Jul 2024 00:05:35 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sP86C-0004W8-P0; Wed, 03 Jul 2024 18:05:12 -0400 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 1sP865-0004Qa-Ih for help-gnu-emacs@gnu.org; Wed, 03 Jul 2024 18:05:09 -0400 Original-Received: from mout.gmx.net ([212.227.17.20]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sP863-0007fl-Hy for help-gnu-emacs@gnu.org; Wed, 03 Jul 2024 18:05:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1720044298; x=1720649098; i=stephen.berman@gmx.net; bh=sZ5oxibpKp2F9SpHv+N0kHEkbESS3a+X/IPoG1fDoNg=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=l5Zn5WlTY1/PFNhafHn5MYFi85e0bfVRqkqRPRFQQ86ZCmLlnX5VsODvlhTdMVDj 2AYynXA3y8eN0Cke5W9PLQ9BHnzwWkeeQY9e7EFhT/LuVSi+Ti5PCxWWmw1IQjjDn 3dlBKTPWvaB4AoZYDXzHCzImLyBccRr+heCAB2OTOPHPSWAz/nWRoPY98GCWksKom PKOZ18O5OidrceLgiiKzxr2YO3IrybBaMT8veUi51ErAZH2J203OG6Q6apWEGhieQ 4ELbmfiK9wH9XtUeSQg9qDiuowhZiuawcW+XL1v2arw2yCIim6A65ueoY0W4EAq8I HaVl/Y2pO2lvXsx+zQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from strobelfs ([88.130.49.113]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MKbkC-1shkuM3HH2-00VZ85; Thu, 04 Jul 2024 00:04:58 +0200 In-Reply-To: (Heime's message of "Wed, 03 Jul 2024 21:56:48 +0000") X-Provags-ID: V03:K1:xVw6A/KIGWV4pHpSsyplYLGB1MeXQEZPfWgSmbQ5+k4vv/luK0f Q2EVEFLyYGX5zJ3sZP8362FOs9xyU7N5DG+z1dzaYTlrOO0YTFS31MbLovD6yAoCy+5QrgT Ugkr+1UL2E1+AVIqjlOqu4SGVIgEBgIQujIArAV1A6hnUdz9EB/DC6YkIeq5FbpaPNbiqeb fZNTpc99NbxfST/XiPxng== UI-OutboundReport: notjunk:1;M01:P0:SgxNgv4EDyQ=;WjwZ+R0GuEPNQUSBI8dv1lxTN7D 53u02W5lrA+GehiwoTxYe8MltbHc+h9fmVt5IrXsxvy11CSYanr/68IdLo/Yd+pBVRvB/+iBq Teiur13EocL5cLp+pWl88MgzcUKSAdDx1aBmTdP/NYzhQubjxuzLAqknnITFpGOWlAJkoUpm8 8mCLm0ZP3kLsgTi1rBT90eGkP5qtBf+xXiNHG+KLF9MAl0YIIUEHgCdsHWyYx9t7DJLKUqWua dYuyq0nIZLj1ywUXrotTU4h1w6L1wipAyjg2xWgKv2aUCEDzZgB5cQ/fIzrVLqcu4cYwyxzrL bScX5acDUshDq1YDgp1y67lG6jEV/1bwaE+sAAUohPbVYbShhSbNdNXtRna+T/RozYY0P9d48 +qKTJeDoaZHpIaeJbfIC2kPSMV0GYLMhJx0qDPhS1X3c19iOgfDOfywpu/TIMcQZhymvxpXHK dC7/mUrJpRjhSnRDWaLl6F74g3Uf6TNx3YIb8mnFkDffR9GpX/xIrngbTrKkb/elCP/1CFVRs mQYzXugMVEUsYq3AHMehY4SbbwBQgCfd4PSoFxgyt/WYq7gloUR+Gs0mWRxifwB3TYkZJBtnC BhISGIcZUAIZkXIySURKF0JHMcAbf6mHdkg3X1W5CbFdcOPbonD16yifZuuMydNI+oei0ewch k1DrmF3FPvSaT6+b0hDUTLxm1NciZlnJCcPhiDdizLZnrhR7qQhpJ+Ww8YZWeOYhvqSd0CCs+ xAhKdK9zI8UImdbFbFjmIzypIfOG00MuDkucJUAenb/D2Egx+LOCptuXgt7fVKKrLU4pIfsq Received-SPF: pass client-ip=212.227.17.20; envelope-from=stephen.berman@gmx.net; helo=mout.gmx.net 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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:147066 Archived-At: On Wed, 03 Jul 2024 21:56:48 +0000 Heime wrote: > Sent with Proton Mail secure email. > > On Wednesday, July 3rd, 2024 at 9:51 PM, Stephen Berman > wrote: > >> On Wed, 03 Jul 2024 21:21:34 +0000 Heime heimeborgia@protonmail.com wrot= e: >>=20 >> > Does elisp support function arguments optional default values ? >>=20 >>=20 >> The answer is in the Elisp manual (info "(elisp) Argument List"): >>=20 >> If actual arguments for the optional and rest variables are omitted, >> then they always default to =E2=80=98nil=E2=80=99. There is no way for t= he function to >> distinguish between an explicit argument of =E2=80=98nil=E2=80=99 and an= omitted >> argument. However, the body of the function is free to consider =E2=80= =98nil=E2=80=99 >> an abbreviation for some other meaningful value. This is what >> =E2=80=98substring=E2=80=99 does; =E2=80=98nil=E2=80=99 as the third arg= ument to =E2=80=98substring=E2=80=99 means to >> use the length of the string supplied. >>=20 >> Common Lisp note: Common Lisp allows the function to specify what >> default value to use when an optional argument is omitted; Emacs >> Lisp always uses =E2=80=98nil=E2=80=99. Emacs Lisp does not support =E2= =80=98supplied-p=E2=80=99 >> variables that tell you whether an argument was explicitly passed. >>=20 >> Steve Berman > > So not like common lisp (var default) > > I have to use UNLESS, perhaps OR.=20 Or other such alternatives, yes. Steve Berman