Re: Reading namespaced keywords

2013-09-17 Thread Dave Ray
Hey, You have too many colons: user= (read-string :l/test) :l/test Dave On Tue, Sep 17, 2013 at 4:03 PM, Casper Clausen casp...@gmail.com wrote: I am reading a bunch of clojure files using the build-in reader (or tools.reader, it has the same problem) and I am running into a problem

Reading namespaced keywords

2013-09-17 Thread Casper Clausen
I am reading a bunch of clojure files using the build-in reader (or tools.reader, it has the same problem) and I am running into a problem regarding namespaced keywords (is that the right term?) such as ::l/test. = (read-string ::l/test) RuntimeException Invalid token: ::l/test

Re: Reading namespaced keywords

2013-09-17 Thread Casper Clausen
The double colon keyword creates a namespaced keyword and is perfectly valid syntax. It's just not used that often :) By default a keyword like ::test resolves to the current namespace like ::current-ns/test, but you can also provide another ns which causes the problem when reading. Have at

Re: Reading namespaced keywords

2013-09-17 Thread Dave Ray
A namespace-qualified keyword has a single colon: :my-namespace/something The double-colon is only shorthand for the current namespace: (in-ns 'my-namespace) ::something - :my-namespace/something Dave On Tue, Sep 17, 2013 at 4:58 PM, Casper Clausen casp...@gmail.com wrote: The double

Re: Reading namespaced keywords

2013-09-17 Thread Andy Fingerhut
Casper, in the example source file you pointed at in the core.logic test suite, the only times it uses the ::namespace/symbol syntax is where namespace is an alias for a namespace that has been created by an earlier :require statement. In my limited testing in Clojure 1.5.1, that syntax throws an

Re: Reading namespaced keywords

2013-09-17 Thread Andy Fingerhut
It is used in test.generative code by Stuart Halloway, which is probably about as supported as you can get: https://github.com/clojure/test.generative/blob/master/src/main/clojure/clojure/test/generative/runner.clj#L55 Andy On Tue, Sep 17, 2013 at 5:16 PM, Andy Fingerhut

Re: Reading namespaced keywords

2013-09-17 Thread Brandon Bloom
The double-colon is only shorthand for the current namespace: Or other namespaces via an alias: (alias 'clj 'clojure.core) ::clj/foo = :clojure.core/foo Inside ns forms, the :as keyword creates aliases. -- -- You received this message because you are subscribed to the Google Groups Clojure

Re: Reading namespaced keywords

2013-09-17 Thread Dave Ray
Cool. You learn something new every day :) On Tuesday, September 17, 2013, Brandon Bloom wrote: The double-colon is only shorthand for the current namespace: Or other namespaces via an alias: (alias 'clj 'clojure.core) ::clj/foo = :clojure.core/foo Inside ns forms, the :as keyword