I think James talking about resolution of values when he said "designates", 
not "the value bound to a key in the map." In other words, the keyword 
:email resolves to the keyword :email, whereas the symbol clojure.core/vec 
resolves to a function.

Keywords-as-keys give you some benefits when you're in clojure (you can use 
them as functions of maps e.g. (:email {:email "a...@b.com"}) returns 
"a...@b.com"), which is part of why they are somewhat ubiquitous in Clojure 
code. In your case, since the system is not written in Clojure, perhaps it 
doesn't matter.

As for your example, I see what you mean re:  {3digits "\\d{3}" 2digits 
"\\d{2}"}, where 3digits is intended to be a symbol that always means 
#"\\d{3}". In a Clojure namespace we'd just (def 3digits #"\\d{3}") and use 
3digits everywhere else. I think keywords, however, would make more sense 
for {:username "vasya" :email "a@b.c"}, because the values bound to 
username and email in that map limited to that map.

Hope that all helps.



On Thursday, October 24, 2019 at 10:48:03 AM UTC-5, Anton Vodonosov wrote:
>
> Regarding the idea that a keyword is an identifier that designates itself, 
> while a symbol is a keyword that designates something else.
>
> Keys in config file map do not designate themselves, they designate the 
> corresponding map values.
>    
>     {username "vasya" email "a@b.c"} 
>
> Here the EMAIL symbol designagtes "a@b.c". Moreover, one of the config 
> file sections allows the user to give arbitrary names to regula 
> expressions. In this config section the user chooses the symbols, the 
> symbols are not predefined in the config file format.
>
>     {3digits "\\d{3}" 2digits "\\d{2}"}
>
> in another config section user can refer the regex by the symbols he 
> defined that way. So the map keys in user's definitions allow hig to give 
> names to values; here the names do not designate themselves, they are names 
> for the regular expressions.
>
> Thinking that way, a keywords can be used as vues. For example, some 
> DIRECTION attribute can have one of 4 values: :up, :down, :left, :right. So 
> map key will be a symbol and value will be a keyword:  
>
>     {speed 100 direction :up}
>
> Note, this config file is unlikely to be used with Clojure. For users, 
> that's just a text document they author in an editor. The system which 
> parses and is configured by this file is written in Java.
>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/a1502e8e-44e0-4bf5-a044-770fc4623cd3%40googlegroups.com.

Reply via email to