From: Heime <heimeborgia@protonmail.com>
To: Stephen Berman <stephen.berman@gmx.net>
Cc: Heime via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org>
Subject: Re: function arguments optional default values
Date: Wed, 03 Jul 2024 21:56:48 +0000 [thread overview]
Message-ID: <goSgGGnAfpI-NPSnLbo4c829IwC0v6o9FDROliCWcTCoB1GomEo_WDc0Jgl7Q5N7jQAtkkdqVZD0A9ZhIBvJ9CYhicsFUY7kHdMeNxcl0GU=@protonmail.com> (raw)
In-Reply-To: <87zfqycffj.fsf@gmx.net>
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.
next prev parent reply other threads:[~2024-07-03 21:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-03 21:21 function arguments optional default values Heime
2024-07-03 21:51 ` Stephen Berman
2024-07-03 21:56 ` Heime [this message]
2024-07-03 22:04 ` Stephen Berman
2024-07-03 22:24 ` Stephen Berman
2024-07-06 12:43 ` Jean Louis
2024-07-06 15:03 ` [External] : " Drew Adams
2024-07-06 15:55 ` Stefan Monnier via Users list for the GNU Emacs text editor
2024-07-06 16:06 ` Drew Adams
2024-07-06 19:04 ` Stefan Monnier via Users list for the GNU Emacs text editor
2024-07-06 21:48 ` Heime
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='goSgGGnAfpI-NPSnLbo4c829IwC0v6o9FDROliCWcTCoB1GomEo_WDc0Jgl7Q5N7jQAtkkdqVZD0A9ZhIBvJ9CYhicsFUY7kHdMeNxcl0GU=@protonmail.com' \
--to=heimeborgia@protonmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=stephen.berman@gmx.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.