On Sun, Sep 18, 2011 at 4:06 AM, Meikel Brandmeyer <m...@kotka.de> wrote:
> Am 18.09.2011 um 05:55 schrieb Ken Wesson:
>>
>> The easiest might be to just pass a map literal (in String form)
>> through the Clojure reader. Variable integers or other simple objects
>> can just be incorporated using the Java String + operator; the
>> concatenation will always start with a string literal such as "{" so
>> this will work in general. (It's likely keywords etc. will be constant
>> while numbers might be variable.)
>
> It's a complete mystery to me why people in the 21st century still promote 
> messing around with strings as FFI when an easy and simple programmatic 
> interface exists, which will *always* work – not only with literals the 
> reader understands. Not to speak about quoting hell and other gotchas.

Tell me which is simpler:

Reader.read("{:foo 1 :bar " + x + "}");

or

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

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

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

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