Hi,

Am 18.09.2011 um 10:11 schrieb Ken Wesson:

> Tell me which is simpler:
> 
> Reader.read("{:foo 1 :bar " + x + "}");

String x = "13rabc";

Have fun.

> Var keyword = RT.var("clojure.core", "keyword");
> Var hashMap = RT.var("clojure.core", "hash-map");
> hashMap.invoke(keyword.invoke("foo"), 1, keyword.invoke("bar"), x);

This one is more simple. This is clojure code. And the example shows what 
unnecessary boilerplate is required in Java which Clojure hides from you. 
Everyone knowing how to call a clojure function understands this code after 
learning how to get a Var from a namespace and how to to invoke it.

And most importantly: it works. Also for the x above. Just like that. Nothing 
more involved.

For yours you have to know what x is. You have to quote it if you want to pass 
it as a string. You have to escape various quotes in strings. You have to know 
features of the reader.

> Nobody suggested using the reader in the cases where it is actually
> more compact to express using stuff like the above, by the way.

Compactness says close to nothing about simplicity.

Sincerely
Meikel

-- 
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

Reply via email to