The problem could be that #{} in clojure is a set literal, try using
clojure.lang.PersistentHashSet/create
>
> Hi
>
> I'm new to Clojure so forgive me if this is a dumb question.  I want
> to incorporate some Clojure into a Java application.
>
>                String rule="(str key val label)";
>                String str = "(ns test) " + "(defn foo [key val label] " +
>                rule +
>                                ")";
>                System.out.println(str);
>
>                Compiler.load(new StringReader(str));
>
>                // Get a reference to the foo function.
>                Var foo = RT.var("test", "foo");
>
>
>                // Call it!
>
>                Object result = foo.invoke( "hello","world","this is a
test");
>
> The code  works BUT if I try to pass in a map for example like so
> Object result = foo.invoke( "hello","world","#{:a 1 :b 2}");
>
> I always get a ClassCastException.  Am I doing something ridiculous
> here?  Is it possible to pass in a Map from the Java world into the
> Clojure code?
>
> Also any comments on using Clojure within a Java app appreciated.  Is
> it a good idea.  I was thinking of allowing rules to be dynamically
> added to fields within a web application.
>
> --
> 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 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