Hi, foop Your error in this line: (r4t (on-thread (prnTime))) You pass to function r4t thread instead of functions. Because (on-thread (prnTime)) returns thread You must pass #(on-thread (prnTime)) instead
Regards, Nikita Beloglazov On Fri, Aug 6, 2010 at 3:13 PM, foop1 <bsmd...@gmail.com> wrote: > Hi, > > Iam trying to run a function in a thread assuming that threads are > runnable, below is my program i want to print 4 time the current date > > > (defn- on-thread [f] > (doto (Thread. #^Runnable f) > (.start))) > > > (defn prnTime [] (prn (System/currentTimeMillis))) > > (defn r4t [f] > (dotimes [n 4] (f))) > > (r4t (on-thread (prnTime))) > iam getting this error what is wrong with this ? > java.lang.Thread cannot be cast to clojure.lang.IFn > > Pls let me know what is wrong and how to make it run in 4 threads so > that i can see 4 time the system print to the screen > > -- > 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<clojure%2bunsubscr...@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