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

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

Re: cl-lib questions


From: Emanuel Berg
Subject: Re: cl-lib questions
Date: Thu, 22 Jul 2021 00:09:51 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Stefan Monnier via Users list for the GNU Emacs text editor wrote:

>> Can you perhaps say a couple of words on the intended use
>> for `setf', I get it it is a generic function (macro) but
>> is there in your mind say one or two typical use cases or
>> something like that to exemplify?
>
> A typical example for me is when you want to modify the field of
> a struct:
>
>     (cl-defstruct my-foo a b c)
>
> then you can set the field `b` of a my-foo struct X to value V with:
>
>     (setf (my-foo-b X) V)
>
> I also like to (ab)use it for things like
>
>     (push (make-new-element)
>           (if (something)
>               x
>             y))
>
>> Also, what is the difference between setf and `setq' with
>> respect to setting `let'/`let*' variables?
>
> None.
>
>> Another cl-lib question is the type of clause usable with
>> `cl-loop' that are described like this in the docstring:
>
> I wouldn't know, I never use `cl-loop`.

OK, thanks!

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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