<div class="gmail_quote">On Fri, Jun 3, 2011 at 23:36, Jay McCarthy <span dir="ltr"><<a href="mailto:jay.mccarthy@gmail.com">jay.mccarthy@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
2011/6/3 Rodolfo Carvalho <<a href="mailto:rhcarvalho@gmail.com">rhcarvalho@gmail.com</a>>:<br>
<div class="im">> Hello,<br>
> I'm curious about 2 design decisions made:<br>
> 1) Why do I have to escape things like "\d{2}" -> "\\d{2}"?<br>
<br>
</div>Because "\d" is the same as "d", because you're escaping the character<br>
#\d. But, the syntax for the regular expression is #\backslash #\d, so<br>
you need to get a backslash in there, which is otherwise a control<br>
character, so you need to escape it.<br></blockquote><div><br></div><div><br></div><div>Well, this I understand - "what it is doing there".</div><div>However, it seems to me that matching a digit is more interesting than matching a backslash followed by a #\d (similar to the others, \w, \s, ...)</div>
<div>When I need to match a backslash I can always escape it.</div><div><br></div><div>So, for me is more "natural" to have "\d" match a digit and "\\d" match a backslash-d.</div><div><br></div>
<div>What motivates choosing the way Racket does it?</div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
><br>
> 2) Why there are two kinds of regexps, #rx and #px?<br>
> #rx"\\d{2}" doesn't work because the curly braces are part of just pregexps<br>
> grammar...<br>
<br>
</div>#px is more powerful than #rx, but that power costs. Most regexps can<br>
get by with what #rx has.<br></blockquote><div><br></div><div><br></div><div>Ah! Now I can think of #px"..." as power-regexp... before this "p" was a mystery. Thanks.</div><div><br></div><div>How high is the cost? Performance x pragmatism... (btw I noticed something similar with #lang racket vs #lang racket/base)</div>
<div><br></div><div> </div></div>