<div>i was writing a unit test which had something analogous to the following:</div><div><br></div><div>(check-equal? #rx"a" #rx"a") => raises exn:test:check</div><div><br></div><div>so i checked and sure enough:</div>
<div><br></div><div>(equal? #rx"a" #rx"a) => #f</div><div><br></div><div>which led me to look for a regexp-equal? so i could do (check regexp-equal? #rx"a" #rx"a")</div><div>that doesn't exist, so i wrote one:</div>
<div><div><font class="Apple-style-span" face="'courier new', monospace"><div><div>(define (regexp-equal? a b)</div><div> (and (and (regexp? a)</div><div> (regexp? b))</div><div> (or (and (pregexp? a)</div>
<div> (pregexp? b))</div><div> (and (not (pregexp? a))</div><div> (not (pregexp? b))))</div><div> (equal? (object-name a)</div><div> (object-name b))))</div></div>
</font></div></div><div><br></div><div>why not just have (equal? #rx"a" #rx"a") => #t ?</div><div>anticipated objection: "what should equal? mean for two regexps?"</div><div>it should mean that the patterns are identical, totally ignoring that two non-identical patterns might match exactly the same set, like #rx"(a|b)" and #rx"(b|a)".</div>
<div>i see in the docs that there is an internal regexp value. if those are what i think they are, i propose equal? just compares those for regexes.</div><div><br></div>