help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: function arguments optional default values


From: Heime
Subject: Re: function arguments optional default values
Date: Wed, 03 Jul 2024 21:56:48 +0000





Sent with Proton Mail secure email.

On Wednesday, July 3rd, 2024 at 9:51 PM, Stephen Berman 
<stephen.berman@gmx.net> wrote:

> On Wed, 03 Jul 2024 21:21:34 +0000 Heime heimeborgia@protonmail.com wrote:
> 
> > Does elisp support function arguments optional default values ?
> 
> 
> The answer is in the Elisp manual (info "(elisp) Argument List"):
> 
> If actual arguments for the optional and rest variables are omitted,
> then they always default to ‘nil’. There is no way for the function to
> distinguish between an explicit argument of ‘nil’ and an omitted
> argument. However, the body of the function is free to consider ‘nil’
> an abbreviation for some other meaningful value. This is what
> ‘substring’ does; ‘nil’ as the third argument to ‘substring’ means to
> use the length of the string supplied.
> 
> 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 ‘nil’. Emacs Lisp does not support ‘supplied-p’
> variables that tell you whether an argument was explicitly passed.
> 
> Steve Berman

So not like common lisp (var default)

I have to use UNLESS, perhaps OR. 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]