Re: How to use params in java?
It's worked! thank you -) -- 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
Re: How to use params in java?
Hi, here an example step-by-step: import clojure.lang.RT; import clojure.lang.IPersistentVector; import clojure.lang.PersistentVector; import clojure.lang.Keyword; public class SomeClass { public static void main(String[] args) { Var prn = RT.var(clojure.core, prn); Keyword a = Keyword.intern(a); Keyword b = Keyword.intern(b); IPersistentVector v = PersistentVector.create(a, b); prn.invoke(v); } } I haven't tested it, but this should print [:a :b]. Hope this helps to get you going. 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
Re: How to use params in java?
Hello, Armando! do you can give me short example? I have some RuntimeExaptions :( On 3 апр, 01:31, Armando Blancas armando_blan...@yahoo.com wrote: You need to use a few more classes from jvm/clojure/lang. For example, with PersistentVector#create(Object...) and one of the Keyword#intern() calls you should be able to construct myParams. On Apr 2, 4:32 am, monyag monyag@gmail.com wrote: -- 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
Re: How to use params in java?
I don't have any examples; using a Clojure lib like that is a real pain. As you can see, interop to Java doesn't just happens but it must be designed into a library. You may want to consider adding an interop layer on top that vijual thingy or use plain scripting for everything and not use invoke. On Apr 3, 11:18 am, monyag monyag@gmail.com wrote: Hello, Armando! do you can give me short example? I have some RuntimeExaptions :( On 3 апр, 01:31, Armando Blancas armando_blan...@yahoo.com wrote: You need to use a few more classes from jvm/clojure/lang. For example, with PersistentVector#create(Object...) and one of the Keyword#intern() calls you should be able to construct myParams. On Apr 2, 4:32 am, monyag monyag@gmail.com wrote: -- 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
Re: How to use params in java?
I don't need concrete example with vijual, I don't understand how to use this parameters whatever vijual -( Thanks for the help, Armando, I'm trying do this. On 4 апр, 06:07, Armando Blancas armando_blan...@yahoo.com wrote: I don't have any examples; using a Clojure lib like that is a real pain. As you can see, interop to Java doesn't just happens but it must be designed into a library. You may want to consider adding an interop layer on top that vijual thingy or use plain scripting for everything and not use invoke. On Apr 3, 11:18 am, monyag monyag@gmail.com wrote: -- 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
Re: How to use params in java?
You need to use a few more classes from jvm/clojure/lang. For example, with PersistentVector#create(Object...) and one of the Keyword#intern() calls you should be able to construct myParams. On Apr 2, 4:32 am, monyag monyag@gmail.com wrote: Hi! I use clojure from java. And I don't know how to send params to clojure I use Vijual Graph Layout Library for Clojure (https://github.com/ drcode/vijual). Some methods has params, for example: (draw-graph-image [[:a :b] [:b :c] [:c :d] [:a :d] [:e :f] [:a :f] [:g :e] [:d :e]]) or (draw-graph-image [[:to-cellar :living-room] [:living- room :kitchen] ...blah blah _ My java code: public static void main(String args[]) throws Exception { BufferedReader br = new BufferedReader(new FileReader(new File(res/test.clj))); StringBuilder sb = new StringBuilder(); String line; while((line = br.readLine())!= null){ sb.append(line); sb.append(\n); } Compiler.load(new StringReader(sb.toString())); RT.var(vijual, func).invoke(I am here!); Var draw = RT.var(vijual, draw-tree-image); Var save = RT.var(vijual, save-image); // params should be here! draw.invoke(myParams); //this is trouble... save.invoke(new BufferedImage(500,500,1), C:/AA); } Can you help me? -- 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