The specification seems ambiguous on this point. The definition of strings
doesn't mention hex or octal escapes, but the definition of characters
does. No relationship between characters and strings is specified.
Characters are unicode, apparently; strings are unspecified.
On Thursday, March 30
A funny thing is that octal or hexadecimal escapes are not part of EDN
(even if most readers recognize them).
On Wed, Mar 29, 2017 at 8:49 PM, Brian Craft wrote:
> A funny hole in the meta-programming story. I don't think the String or
> Character classes have methods that do this.
>
> Also inte
| Also interesting, clojure's print methods will handle some escapes, but not
others
I think that's just that \t is printed as \t. Like a tab shows up as \t.
Whereas say a Unicode like \u1234 will show the character of it. You can seek
that here:
(print (pr-str "foo\u0009bar"))
"foo\t
A funny hole in the meta-programming story. I don't think the String or
Character classes have methods that do this.
Also interesting, clojure's print methods will handle some escapes, but not
others:
cavm.core=> (println (pr-str "foo\tbar"))
"foo\tbar"
nil
cavm.core=> (println (pr-str "foo\
Clojure leans on Java to read that literal. There is no Clojure function to
forcibly print it that way again, but you can probably use the Java methods on
String or Character to get the String representation of a character somehow.
--
You received this message because you are subscribed to the
Is there an easy way to display a string as a string literal that can be
read by clojure?
E.g.
> (let [x "\001"] (what-goes-here x))
"\001"
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.co