unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: "Михаил Бахтерев" <mob@k.imm.uran.ru>
To: guile-user@gnu.org
Subject: Is it possible to expand syntax inside match?
Date: Sun, 24 Oct 2021 11:49:02 +0500	[thread overview]
Message-ID: <YXT/qI6FDv17VqWM@z> (raw)

Greetings!

I wondering, if is it possible to implement something like
this?

(define-syntax R (syntax-rules () ((_ r v l) #(red r v l))))
(define-syntax B (syntax-rules () ((_ r v l) #(black r v l))))

(define red-black-set-balance 
  (match-lambda
    ((or (B (R (R a x b) y c) z d)
         (B (R a x (R b y c)) z d)
         (B a x (R (R b y c) z d))
         (B a x (R b y (R c z d)))) (R (B a x b) y (B c z d)))
    (node node)))

The idea is to have some automation allowing not to write
patterns manually:

  #('black #('red #('red a x b) y c) z d)

- Mikhail Bakhterev, respectfully.



             reply	other threads:[~2021-10-24  6:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-24  6:49 Михаил Бахтерев [this message]
2021-10-24 19:48 ` Is it possible to expand syntax inside match? Maxime Devos

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=YXT/qI6FDv17VqWM@z \
    --to=mob@k.imm.uran.ru \
    --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).