A problem on java class import
I write a swing wrapper for fun. http://gist.github.com/465370 It work well. (eg. http://gist.github.com/465323, http://java.sun.com/docs/books/tutorial/uiswing/components/button.html ButtonDemo example) But there is a small problem troubling me. I must import the Event Listener where I use my "make-listener" or "add-listener" function. (because they are dynamically using the imported java class Symbol) I'm finding a way to just import all the java classes, so that I don't need to always add the redundant import code~ PS: I try to used a big map to map all keyword to full java classes. There're 39 classes, the hard-code is too stupid, so I give up. Some ideas? Thx :-) -- 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: A problem on java class import
I thought my problem again. The import code is unavoidable. the clj- imports script is really help :-) On Jul 7, 6:17 am, Timothy Pratley wrote: > This works great for looking up > classes:http://dishevelled.net/Generating-Clojure-import-lines-using-SLIME.html > <http://dishevelled.net/Generating-Clojure-import-lines-using-SLIME.html>You > can just call the function from the REPL if you don't use SLIME > Hope that helps > > <http://dishevelled.net/Generating-Clojure-import-lines-using-SLIME.html> > Regards, > Tim. > > > > On Tue, Jul 6, 2010 at 6:34 AM, Cachou wrote: > > I write a swing wrapper for fun. > > >http://gist.github.com/465370 > > > It work well. (eg.http://gist.github.com/465323, > >http://java.sun.com/docs/books/tutorial/uiswing/components/button.html > > ButtonDemo example) > > > But there is a small problem troubling me. > > > I must import the Event Listener where I use my "make-listener" or > > "add-listener" function. (because they are dynamically using the > > imported java class Symbol) > > > I'm finding a way to just import all the java classes, so that I don't > > need to always add the redundant import code~ > > > PS: I try to used a big map to map all keyword to full java classes. > > There're 39 classes, the hard-code is too stupid, so I give up. > > > Some ideas? > > > Thx :-) > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group.> To post to this group, send email > > tocloj...@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
Re: How to convert a list to arguments?
Another way: suppose test-list -> (list 1 2 3) `(max ~...@test-list) can translate the form to what you want so you can use eval or define a macro to handle it. On Jul 5, 11:38 am, Mike Meyer wrote: > On Sun, 4 Jul 2010 20:21:22 -0700 (PDT) > > dennis wrote: > > For example: > > (max 1 2 3) => 3 > > (max (list 1 2 3)) => (1 2 3) > > > How to convert (list 1 2 3) to arguments for function? > > Sounds like you want apply: > > (apply max (list 1 2 3)) => 3 > > -- > Mike Meyer http://www.mired.org/consulting.html > Independent Network/Unix/Perforce consultant, email for more information. > > O< ascii ribbon campaign - stop html mail -www.asciiribbon.org -- 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: Clojure finally on SPOJ!
Even the "TEST" Problem will TLE!!! My code is here: (ns spoj-test) (defn read-int [] (let [s (read-line)] (Integer/parseInt s))) (defn main [] (let [n (read-int)] (when (not (== 42 n)) (println n) (recur (main) the sample input is OK. On Jul 25, 3:51 pm, sphere research wrote: > Hi, > > now, you can solve problems/submit problems in Clojure on SPOJ, > > good luck, > > regards, > SPOJ Team > > ps. > > We are very happy to announce that users' accounts have finally > appeared on Ideone :) > If you liked Ideone as it has been so far, you will like the new one > even more. The most important new features available for Ideone users > are: > > * management panel where users can view and group their pastes, > * personalized access to Ideone API > * and public folders which allow to publish and share a group of > pastes at one go. -- 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: Clojure finally on SPOJ!
Maybe SPOJ treat clojure as script language. In fact, though clojure is quite fast, loading the clojure.jar library takes a bit of time. And SPOJ count the class loading time into the running time. If the Judge Machine is similar to ideone.com, maybe the clojure.jar loading time is about 0.6~0.7s. Only the class loading time will TLE the problem if there is more than 2 cases. I hope It's not true... On Jul 27, 5:39 pm, Matthias Schneider wrote: > And on nearly all problems Clojure isn't an accepted language (yet?). > Does the person who submitted the problem has to update this? > > -matthias > > On Jul 25, 12:34 pm, Cachou wrote: > > > > > Even the "TEST" Problem will TLE!!! > > > My code is here: > > > (ns spoj-test) > > > (defn read-int > > [] > > (let [s (read-line)] > > (Integer/parseInt s))) > > > (defn main > > [] (let [n (read-int)] > > (when (not (== 42 n)) > > (println n) > > (recur > > > (main) > > > the sample input is OK. > > > On Jul 25, 3:51 pm, sphere research wrote: > > > > Hi, > > > > now, you can solve problems/submit problems in Clojure on SPOJ, > > > > good luck, > > > > regards, > > > SPOJ Team > > > > ps. > > > > We are very happy to announce that users' accounts have finally > > > appeared on Ideone :) > > > If you liked Ideone as it has been so far, you will like the new one > > > even more. The most important new features available for Ideone users > > > are: > > > > * management panel where users can view and group their pastes, > > > * personalized access to Ideone API > > > * and public folders which allow to publish and share a group of > > > pastes at one go. -- 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