# [plt-scheme] Shortening the rope in the matcher

I just spent an hour hunting down a bug in the Galore red/black tree
implementation. Here was the offending function:
(define (unbalanced-right s)
(match s
[($ R t1 x1 ($ B t2 x2 t3)) (values (rbalance t1 x1 (R- t2 x2 t3)) #f)]
[($ B t1 x1 ($ B t2 x2 t3)) (values (rbalance t1 x1 (R- t2 x2 t3)) #t)]
[($ B t1 x1 ($R ($ B t2 x2 t3) x3 t4)) (values (B- (rbalance t1 x1 (R- t2 x2 t3)) x3 t4) #f)]
[_ (error)]))
The bug was the missing space between $ and R.
Would the restriction "no pattern variable can start with $"
be a useful restriction in the pattern matcher?
--
Jens Axel Søgaard