<div>i was writing a unit test which had something analogous to the following:</div><div><br></div><div>(check-equal? #rx&quot;a&quot; #rx&quot;a&quot;)  =&gt; raises exn:test:check</div><div><br></div><div>so i checked and sure enough:</div>
<div><br></div><div>(equal? #rx&quot;a&quot; #rx&quot;a) =&gt; #f</div><div><br></div><div>which led me to look for a regexp-equal? so i could do (check regexp-equal? #rx&quot;a&quot; #rx&quot;a&quot;)</div><div>that doesn&#39;t exist, so i wrote one:</div>
<div><div><font class="Apple-style-span" face="&#39;courier new&#39;, 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&quot;a&quot; #rx&quot;a&quot;) =&gt; #t ?</div><div>anticipated objection: &quot;what should equal? mean for two regexps?&quot;</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&quot;(a|b)&quot; and #rx&quot;(b|a)&quot;.</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>