unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Is it possible to expand syntax inside match?
@ 2021-10-24  6:49 Михаил Бахтерев
  2021-10-24 19:48 ` Maxime Devos
  0 siblings, 1 reply; 2+ messages in thread
From: Михаил Бахтерев @ 2021-10-24  6:49 UTC (permalink / raw)
  To: guile-user

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.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-24 19:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-24  6:49 Is it possible to expand syntax inside match? Михаил Бахтерев
2021-10-24 19:48 ` Maxime Devos

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).