I'm in reader hell right now, trying to puzzle out how escape sequences and
printing work for strings and regular expressions.

I notice that:
(re-pattern "a\nb")
(re-pattern "a\\nb")
(re-pattern "a\\\nb")

all produce semantically equivalent regular expressions that match "a\nb"

The middle one prints the way I'd expect, as #"a\nb"

However, the first and last example print as:
#"a
b"

Even weirder, printing it with pr has no effect, and it still prints as:
#"a
b"

I can sort of imagine why the middle one (re-pattern "a\\nb") might be
stored internally in a somewhat different format than the other two, but I
really can't figure out why the "machine-oriented print" of pr would still
print the blank line rather than \n in this context.

Bug or feature?

Can anyone point me to the relevant code where I can get a better
understanding of how the reading and printing of regexps differs from
strings?

--Mark

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to