To make a URI into a Clojure keyword namespace, we may simply replace
the 11 URI characters that are forbidden or problematic in keywords
with Unicode-alphabetic characters outside Latin-1.
The substitutes should be present in common desktop fonts, and should
not be mistaken for Latin-1 characters. They should come from a
single Unicode script, to avoid burdensome Unicode puns. It should
be a raster script that does not require decades of handwriting practice.
Cyrillic fits the bill very well: it's recognizable and out-of-band. You'd
never type these URI keywords in, but Cyrillic is a software-selectable
keyboard so you could if you felt like it.
Here is a demonstration of a simple URI <-> keyword translator
and a keyword-namespace aliasing macro to facilitate relatively
painless use of namespace literals in source code.
(To furthermore overcome the problem that "%" hex expressions compare
case-blind in URIs, but not keywords, we should norm %xx to %XX as RFC
3986 recommends before converting to a keyword namespace.)
(def problems [\. \~ \: \/ \[ \] \@ \( \) \, \;])
(def solutions [\Я \ж \ц \Л \П \Ю \Ж \ъ \Ъ \г \д])
(defn- tr [a b]
(let [m (zipmap a b)]
(apply str (map #(m % %) s)))))
(tr problems solutions))
(tr solutions problems))
(defmacro alias-xml-ns [sym uri]
`(let [kwns# (symbol (uri->kwns ~uri))]
(alias ~sym kwns#)))
(alias-xml-ns 'html "http://www.w3.org/1999/xhtml")
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to firstname.lastname@example.org
Note that posts from new members are moderated - please be patient with your
To unsubscribe from this group, send email to
For more options, visit this group at
You received this message because you are subscribed to the Google Groups
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.