[plt-scheme] "raw" strings

From: Todd O'Bryan (toddobryan at gmail.com)
Date: Fri Sep 18 19:21:54 EDT 2009

I hate to ask this, given how much I've been burned by mentioning
experience with Python before, but...

One of my favorite features of Python is the fact that you can delimit
strings with either " or '. That way, you can enclose strings that
have double-quotes in apostrophes and strings that have apostrophes in

Clearly, this won't work with Scheme because of symbols, but another
really nice feature of Python is the "raw" string, which is especially
useful in things like regular expressions. Basically, a raw string
(with the letter 'r' prepended to the front of the first quote)
doesn't treat a backslash as a meta-character.

So, if I want to match strings like 455 \ 22, 127 \ 31, or 3 \
5--corresponding to the regex \d+\s\\\s\d+, instead of typing


I'd type


which is ever so much more readable.

Since PLT already has #rx"patt" and #px"patt" patterns, how hard would
it be to create a version that lets you avoid the insane amounts of
backslash escaping?


Posted on the users mailing list.