Clojure follows the principle of "Garbage in, Garbage out" for a lot of 
internal functions. Meaning you are responsible for ensuring that you only 
use valid data when calling those functions as the validation itself 
carries overhead which the core fns should not have.

:a/0 fails because the reader does those checks and fails. The keyword fn 
does no checks and lets you have your invalid keywords. They are still 
invalid keywords though. Keywords are not allowed to start with numbers. might be a helpful reference about that 
is allowed and what isn't.


On Thursday, March 1, 2018 at 1:14:34 PM UTC+1, wrote:
> I've encountered a problem when creating namespaced keywords using the 
> literal syntax, specifically using keywords which start with numbers. 
> If I try using the literal syntax, entering the following at the REPL, I 
> get the exception which follows it:
> :a/0
> ;= clojure.lang.ExceptionInfo: NO_SOURCE_FILE [line 1, col 5] Invalid 
> keyword: :a/0. {:type :reader-exception, :ex-kind :reader-error, :file 
> "NO_SOURCE_FILE", :line 1, :col 5} ...
> If instead I use the the keyword function, it produces the desired result:
> (keyword "a" "0")
> ;= :a/0
> It seems I can get away with almost anything using the keyword function. 
> For example:
> (keyword "a" "0/1")
> ;= :a/0/1
> I'm wondering then, what is the "correct" behaviour if there is such a 
> thing in this case? I know that in Clojure the behaviour appears once again 
> to be slightly different, and the main docs seem to cater more to Clojure 
> than to CLJS.
> Thank you,
> Ali

Note that posts from new members are moderated - please be patient with your 
first post.
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
To post to this group, send email to
Visit this group at

Reply via email to