unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Jean Abou Samra <jean@abou-samra.fr>
To: guile-user@gnu.org
Subject: Macro to prepend element to list
Date: Sat, 20 Mar 2021 15:24:30 +0100	[thread overview]
Message-ID: <7e1286e7-3135-7747-9e25-395ffab3362e@abou-samra.fr> (raw)

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	other threads:[~2021-03-20 14:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-20 14:24 Jean Abou Samra [this message]
2021-03-20 16:04 ` Macro to prepend element to list Linus Björnstam
2021-03-20 17:05   ` Jean Abou Samra
2021-03-20 18:10     ` Linus Björnstam
2021-03-20 20:16       ` Jean Abou Samra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7e1286e7-3135-7747-9e25-395ffab3362e@abou-samra.fr \
    --to=jean@abou-samra.fr \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).