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

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

Re: Copying a list for insertion


From: tomas
Subject: Re: Copying a list for insertion
Date: Sat, 22 Oct 2022 09:07:49 +0200

On Sat, Oct 22, 2022 at 09:43:31AM +0300, Jean Louis wrote:
> * Heime <heimeborgia@protonmail.com> [2022-10-22 04:03]:

[...]

> > "cond" allows multiple body-forms in one clause.  Thusly no need for 
> > "progn".
> 
> Show me how please. I do not understand it.

Heime is right:

  (defun do-something (arg)
    (cond
     ((eq arg 'this)
      (message "yes, this")
      (message "did I say this?")
      (message "yes, I said"))
     ((eq arg 'that)
      (message "what was that?")
      (message "this example gets boring"))
     (t
      (message "what?"))))
  
  (do-something 'this)

Besides, the doco says that a clause returns its last espression's
value, so it does behave like many little progn.

Cheers
-- 
t

Attachment: signature.asc
Description: PGP signature


reply via email to

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