Re: Symbol to keyword

2009-08-25 Thread Jarkko Oranen
On Aug 25, 1:47 pm, Dragan Djuric wrote: > I needed a macro if I wanted to avoid ' in calls. It may seem as > nitpicking but (to-keyword name) is more readable and less error prone > than (to-keyword 'name) if I need to  use it in lots of places. If that's all you do, then the easiest approach

Re: Symbol to keyword

2009-08-25 Thread Dragan Djuric
And the problem with the plain (keyword x) approach is how the namespace resolving works in that case. I can see that some things have been improved in Clojure 1.1 compared to 1.0, but there is still one thing: In 1.1. if I call (keyword 'foo/bar) i'll get :foo/bar. OK, because the namespace is e

Re: Symbol to keyword

2009-08-25 Thread Dragan Djuric
I needed a macro if I wanted to avoid ' in calls. It may seem as nitpicking but (to-keyword name) is more readable and less error prone than (to-keyword 'name) if I need to use it in lots of places. On Aug 24, 8:38 pm, Achim Passen wrote: > Hi! > > Am 24.08.2009 um 18:31 schrieb Dragan Djuric:

Re: Symbol to keyword

2009-08-25 Thread Meikel Brandmeyer
Hi, On Aug 24, 8:51 pm, Konrad Hinsen wrote: > > Yes. The trick is that > > (keyword 'x/y) > > is different from > > (ns x) > > ::y > > Not in my copy of Clojure: > > user=> (ns x) > nil > x=> ::y > :x/y > x=> (identical? ::y (keyword 'x/y)) > true This does not work in Clojure 1.0. As well as

Re: Symbol to keyword

2009-08-24 Thread Meikel Brandmeyer
Hi, Am 24.08.2009 um 20:03 schrieb Laurent PETIT: Yes. The trick is that (keyword 'x/y) is different from (ns x) ::y ?? ::y is similar to `y. (Besides the resolving issue, which doesn't make sense for keywords...) For keyword there was some issue, that (keyword "foo/bar") creates a ke

Re: Symbol to keyword

2009-08-24 Thread Achim Passen
Hi! Am 24.08.2009 um 18:31 schrieb Dragan Djuric: > I needed (and created) a macro to generate keywords from symbols. I > couldn't find anything ready, and I am still not completely > comfortable with the solution I came up with. Any suggestions for > improvement? If I understand you correctly,

Re: Symbol to keyword

2009-08-24 Thread Konrad Hinsen
On 24 Aug 2009, at 19:55, Dragan Djuric wrote: > Yes. The trick is that > (keyword 'x/y) > is different from > (ns x) > ::y Not in my copy of Clojure: user=> (ns x) nil x=> ::y :x/y x=> (identical? ::y (keyword 'x/y)) true Konrad. --~--~-~--~~~---~--~~ You re

Re: Symbol to keyword

2009-08-24 Thread Laurent PETIT
2009/8/24 Dragan Djuric > > Yes. The trick is that > (keyword 'x/y) > is different from > (ns x) > ::y ?? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojur

Re: Symbol to keyword

2009-08-24 Thread Dragan Djuric
Yes. The trick is that (keyword 'x/y) is different from (ns x) ::y On Aug 24, 7:07 pm, Konrad Hinsen wrote: > On 24 Aug 2009, at 18:31, Dragan Djuric wrote: > > > I needed (and created) a macro to generate keywords from symbols. I > > couldn't find anything ready, and I am still not completely >

Re: Symbol to keyword

2009-08-24 Thread Konrad Hinsen
On 24 Aug 2009, at 18:31, Dragan Djuric wrote: > I needed (and created) a macro to generate keywords from symbols. I > couldn't find anything ready, and I am still not completely > comfortable with the solution I came up with. Any suggestions for > improvement? What are your exact requirements?