From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Heime Newsgroups: gmane.emacs.help Subject: Re: function arguments optional default values Date: Wed, 03 Jul 2024 21:56:48 +0000 Message-ID: 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="19156"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Heime via Users list for the GNU Emacs text editor To: Stephen Berman Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jul 03 23:57:28 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 1sP7yi-0004lZ-C0 for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 03 Jul 2024 23:57:28 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sP7yE-0000b2-Vh; Wed, 03 Jul 2024 17:56:59 -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 1sP7yC-0000Za-Ed for help-gnu-emacs@gnu.org; Wed, 03 Jul 2024 17:56:56 -0400 Original-Received: from mail-40138.protonmail.ch ([185.70.40.138]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sP7yA-0007wt-S7 for help-gnu-emacs@gnu.org; Wed, 03 Jul 2024 17:56:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1720043812; x=1720303012; bh=9pHAJJu1KtAP3Pthn21i9fsruwwa2P48H7s7JfEBSYA=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=aTm6JBrklrC7uNciBk9vS+hVON4+f6x4i80mC8sSs2jH0CCJwmvUHIClnX4cBfHDG iCJZ62UIRg8xCIOpwz7C6M8+SpY5iou2QAT5SAFm7hHB3XiAwHndhd6N8VY+a3gpBz 5Zvqj65Q0Ivs8N7oFbQkvNKsR7w4dS1rwzYQAvHPjABKAtfsk9p9vH3kqLQclTmu5M Wzaa4HrDOyqwokqb9sQ4VzAsfQdfKubv2ecLoF2cZZNbuqRSufvaAK4LN0CoVkrpga M3ybB/I+CRHA/ZgRn+mKaXIK0OgUMRQXJl4t6X0uBffe9TrA30E/o9XUxjArNSDqgA +a1Glvdl/43jQ== In-Reply-To: <87zfqycffj.fsf@gmx.net> Feedback-ID: 57735886:user:proton X-Pm-Message-ID: afc866c8a4cd695b9e248b4436abd84b10ed0273 Received-SPF: pass client-ip=185.70.40.138; envelope-from=heimeborgia@protonmail.com; helo=mail-40138.protonmail.ch 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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:147065 Archived-At: 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 wrote= : >=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 th= e 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 argu= ment 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