From: Heime via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: Heime via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org>
Subject: List Argument followed by &rest
Date: Sun, 08 Dec 2024 00:12:14 +0000 [thread overview]
Message-ID: <f8a8DhLFGa1iszh9wAE1nCoZApnVElOlhiRcwxEzP841p5NuPLcFsCjhKD6uUQTLoZ8xjSAGu3lRveKVHgBLA2ZHb6qZ4h0Jc7xFOTt9rrQ=@protonmail.com> (raw)
Consider the following function with an argument and with
&rest.
The first argument is a list (if single element is provided,
it is converted to a list).
Thus I can write
(medha-kntlr 'armg basic substring)
and
(medha-kntlr '(armg go) basic substring)
And styles can also be considered as a list of arguments, am I right?
Is this how it works?
(defun medha-kntlr (seqr &rest styles)
(let ( (seqr (if (listp seqr) seqr (list seqr))) )
(dolist (actm actm-seqr)
(pcase actm
('armg (dolist (style styles)
(message "Style: %s" style)))
('go (setq completion-styles styles))
(_ (message "Invalid Argument")) ))))
next reply other threads:[~2024-12-08 0:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-08 0:12 Heime via Users list for the GNU Emacs text editor [this message]
2024-12-12 11:09 ` List Argument followed by &rest Joel Reicher
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='f8a8DhLFGa1iszh9wAE1nCoZApnVElOlhiRcwxEzP841p5NuPLcFsCjhKD6uUQTLoZ8xjSAGu3lRveKVHgBLA2ZHb6qZ4h0Jc7xFOTt9rrQ=@protonmail.com' \
--to=help-gnu-emacs@gnu.org \
--cc=heimeborgia@protonmail.com \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).