guile-user
[Top][All Lists]
Advanced

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

Macro to prepend element to list


From: Jean Abou Samra
Subject: Macro to prepend element to list
Date: Sat, 20 Mar 2021 15:24:30 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1

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

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