unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* List Argument followed by &rest
@ 2024-12-08  0:12 Heime via Users list for the GNU Emacs text editor
  2024-12-12 11:09 ` Joel Reicher
  0 siblings, 1 reply; 2+ messages in thread
From: Heime via Users list for the GNU Emacs text editor @ 2024-12-08  0:12 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor


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")) ))))





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: List Argument followed by &rest
  2024-12-08  0:12 List Argument followed by &rest Heime via Users list for the GNU Emacs text editor
@ 2024-12-12 11:09 ` Joel Reicher
  0 siblings, 0 replies; 2+ messages in thread
From: Joel Reicher @ 2024-12-12 11:09 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor; +Cc: Heime

Heime via Users list for the GNU Emacs text editor 
<help-gnu-emacs@gnu.org> writes:

> 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)

Doesn't the "a b c d e" example at "(elisp) Argument List" answer 
this?

Is the documentation unclear?

Regards,

        - Joel



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-12-12 11:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-08  0:12 List Argument followed by &rest Heime via Users list for the GNU Emacs text editor
2024-12-12 11:09 ` Joel Reicher

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).