<div dir="ltr"><div><div>Okay, I've extended the readtable.<br></div>At-exp is preferable, and I do use at-exps in other circumstances.<br></div>Thank you, Greg.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Wed, Nov 6, 2013 at 5:40 AM, Greg Hendershott <span dir="ltr"><<a href="mailto:greghendershott@gmail.com" target="_blank">greghendershott@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Well, I think Ryan is talking about people who are coding a new<br>
feature that's nearly ready. Not soliciting ideas for last-minute<br>
ideas to try to rush into v6. Nice try, though. :)<br>
<br>
Having said that, have you tried using at-exps for this?<br>
<br>
I've only thought about this for a few minutes, and there are pros and<br>
cons, but:<br>
<br>
- - - - - - -<br>
<br>
#lang at-exp racket<br>
;; ^^^^^^<br>
<br>
;; Don't like regexps in quotes?<br>
(regexp-match #px"^foo" "foo")<br>
<br>
;; Do this instead:<br>
(regexp-match @pregexp{^foo} "foo")<br>
<br>
;; OK, but:<br>
;; 1. A bit verbose.<br>
;; 2. Those aren't precompiled regexps, like with #px<br>
;; 3. Also if the {} spans multiple lines, it needs to be converted<br>
;; into just one string.<br>
;; So:<br>
<br>
(define px (compose1 pregexp ~a))<br>
(define rx (compose1 regexp ~a))<br>
<br>
;; Now you can write this:<br>
(regexp-match @px{^foo} "foo")<br>
<br>
;; Ta da !!<br>
<br>
;; You can include newlines without using \n<br>
(regexp-match @px{^foo<br>
bar} "foo\nbar")<br>
<br>
;; But bad news, you can't use \n anymore.<br>
;; (regexp-match @px{^foo[\n]bar} "foo\nbar")<br>
;; => regexp: illegal alphabetic escape<br>
<br>
;; The other way is to @ quote:<br>
@~a{@#\newline}<br>
@~a{@"\n"}<br>
(regexp-match @px{^foo@"\n"bar} "foo\nbar")<br>
<br>
;; OTOH, good news is that regexp backslashes can be used as-is -- no<br>
;; need for the extra \<br>
(regexp-match @px{1\.0} "1.0")<br>
<br>
;; p.s. How to escape @ in an at-exp? @"@"<br>
(regexp-match @rx{^foo@"@"bar\.com} "<a href="mailto:foo@bar.com">foo@bar.com</a>")<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On Mon, Nov 4, 2013 at 8:40 PM, WarGrey Gyoudmon Ju<br>
<<a href="mailto:juzhenliang@gmail.com">juzhenliang@gmail.com</a>> wrote:<br>
> Could you please make the regular expression syntax more elegant?<br>
> To replace the "" with // or any other character as its boundary.<br>
><br>
> Here is the example:<br>
> #px/^\s*\/([^\/])\/\s*$/ === #px@^\s*/([^/])/\s*$@ ===<br>
> #px"^\\s*/([^/])/\\s*$"<br>
><br>
> Thank you in advance.<br>
><br>
><br>
> On Tue, Nov 5, 2013 at 12:51 AM, Ryan Culpepper <<a href="mailto:ryanc@ccs.neu.edu">ryanc@ccs.neu.edu</a>> wrote:<br>
>><br>
>> The release process for v6.0 will begin in about a week. If<br>
>> you have any new features that you want in and are relatively close<br>
>> to being done, now is a good time to do that.<br>
>> _________________________<br>
>> Racket Developers list:<br>
>> <a href="http://lists.racket-lang.org/dev" target="_blank">http://lists.racket-lang.org/dev</a><br>
><br>
><br>
><br>
> _________________________<br>
> Racket Developers list:<br>
> <a href="http://lists.racket-lang.org/dev" target="_blank">http://lists.racket-lang.org/dev</a><br>
><br>
</div></div></blockquote></div><br></div>