Hi,
Am 19.10.2009 um 06:39 schrieb Gorsal:
> So now that the future is working, I'm attempting to print from an
> actual java thread. Like this
>
> (defmacro with-thread [nm & body]
> `(let [thread# (Thread. #(fn [] (do ~...@body)))]
> ~@(if nm `((.setName thread# ~nm)))
> (.start thread
On Mon, Oct 19, 2009 at 12:39 AM, Gorsal wrote:
>
> So now that the future is working, I'm attempting to print from an
> actual java thread. Like this
>
> (defmacro with-thread [nm & body]
> `(let [thread# (Thread. #(fn [] (do ~...@body)))]
> ~@(if nm `((.setName thread# ~nm)))
> (.start
Thanks. I think now that i recall i have made that mistake before. I
must differentiate - fn and #()!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googl
Just an addendum to my last post - without the .start you can test it better;
(defmacro with-thread [nm & body]
`(let [thread# (Thread. (fn [] (do ~...@body)))]
(if ~nm (.setName thread# ~nm))
;(.start thread#)
thread#))
(def th (with-thread "foo" (println "Hasdfasdfasdfasdfasdfasdf
The following seems to do it;
(defmacro with-thread [nm & body]
`(let [thread# (Thread. (fn [] (do ~...@body)))]
(if ~nm (.setName thread# ~nm))
(.start thread#)
thread#))
(with-thread "foo" (println "HasdfasdfasdfasdfasdfasdfasdfasdfI"))
#
user=> HasdfasdfasdfasdfasdfasdfasdfasdfI
On Oct 19, 3:39 pm, Gorsal wrote:
> Except no output! Eeek!!! What am i doing wrong?
Looks like #(fn ... is meant to be #(do ~...@body)
#(fn declares a function which creates a function, so your thread is
returning a function instead of executing it.
user=> (macroexpand-1 '(with-thread nil (pr
On Sun, Oct 18, 2009 at 10:22 PM, Gorsal wrote:
>
> Hey, is there any way to separate the out view from the repl view so i
> don't have to switch back and forth?
>
In Enclojure? Unfortunately, apparently not. It's possible to undock the
REPL and make it a free-floating window, but all three of th
So now that the future is working, I'm attempting to print from an
actual java thread. Like this
(defmacro with-thread [nm & body]
`(let [thread# (Thread. #(fn [] (do ~...@body)))]
~@(if nm `((.setName thread# ~nm)))
(.start thread#)
thread#))
(with-thread nil (println "Hasdfasd
Hey, is there any way to separate the out view from the repl view so i
don't have to switch back and forth?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@
Thanks, this works.
--~--~-~--~~~---~--~~
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
> Most likely, though, it's an unfortunate effect of how futures print
> themselves:
>
> user=> (future (* 3 4))
> #
I agree - this is the cause, if you really wanted to do this at the
REPL maybe you can get around it like this:
user=> (do (future (* 3 4)) nil)
nil
--~--~-~--~~---
On Sun, Oct 18, 2009 at 5:59 PM, Gorsal wrote:
>
> I'm attempting to use the function future to start something in
> another thread. However, in the netbeans enclojure plugin, when i type
> it into the repl, it becomes non-responsive. Is this just a bug in the
> enclojure plugin or would this be
I'm attempting to use the function future to start something in
another thread. However, in the netbeans enclojure plugin, when i type
it into the repl, it becomes non-responsive. Is this just a bug in the
enclojure plugin or would this be normal?
(future
(let [input-stream (:input-stream *li
13 matches
Mail list logo