Well, mutating like that is not very common, except for maybe with alists.

In which situations are you mutating the list like that? Usually you would 
build a reverse list using a recursive function and an accumulator, which can 
be done without set! (which has a boxing overhead).

-- 
  Linus Björnstam

On Sat, 20 Mar 2021, at 15:24, Jean Abou Samra wrote:
> Hello,
> 
> I find myself frequently using the following macro:
> 
> (define-macro (prepend! thing lst)
>     `(set! ,lst (cons ,thing ,lst)))
> 
> Have I missed a module somewhere that does this kind of things?
> At least, I couldn't find anything in SRFIs. It may also be the
> case that this is too specific to certain non-functional usages
> (LilyPond in my case).
> 
> Thanks in advance,
> Jean Abou Samra
> 
> 
>

Reply via email to