[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Is it possible to expand syntax inside match?
From: |
Михаил Бахтерев |
Subject: |
Is it possible to expand syntax inside match? |
Date: |
Sun, 24 Oct 2021 11:49:02 +0500 |
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.
- Is it possible to expand syntax inside match?,
Михаил Бахтерев <=