I'm not entirely sure what you're trying to accomplish in a larger context, but perhaps you're looking for something like this?
(delay (deref (future (and (Thread/sleep 2000) (+ 1 2))))) ... or maybe you want just `delay` Cheers, Paul On Thursday, May 30, 2013 6:09:02 AM UTC-7, David Pollak wrote: > > Okay... I wrote my own: > > > https://github.com/projectplugh/plugh/blob/master/src/plugh/util/misc.clj#L51 > > One can register for on-done and on-fail. I'll work on adding fail-fast > and also map (so one can transform the future and execute code when the > transformed future has been realized/delivered/finished). > > Thanks for your help! > > > > On Thu, May 30, 2013 at 2:17 AM, Gary Trakhman > <gary.t...@gmail.com<javascript:> > > wrote: > >> by the second future, I mean an instance of >> http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/Future.html , >> which just has to conform to the interface, and doesn't actually have to >> execute on a different thread. Clojure's 'future' function returns an >> instance of one of these that uses the unbounded agent thread-pool, but you >> would be free to return one using reify or something. >> >> >> https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L6320 >> >> >> On Thu, May 30, 2013 at 5:14 AM, Gary Trakhman >> <gary.t...@gmail.com<javascript:> >> > wrote: >> >>> Maybe an easy solution: wrap the first future in another future that >>> blocking-derefs, then performs your extra computation? Do an extra >>> 'realized?' check for the optimization you mention. That would still >>> consume threads in the case that it's not realized, but I think it gets you >>> what you want. >>> >>> >>> On Thu, May 30, 2013 at 5:09 AM, Mark Engelberg >>> <mark.en...@gmail.com<javascript:> >>> > wrote: >>> >>>> According to this article, Clojure does not yet have this facility: >>>> http://java.dzone.com/articles/promises-and-futures-clojure >>>> >>>> This is something that is being worked on and discussed, though: >>>> http://dev.clojure.org/display/design/Promises >>>> >>>> https://groups.google.com/forum/#!topic/clojure-dev/7BKQi9nWwAw/discussion >>>> http://dev.clojure.org/display/design/Async+blocks >>>> >>>> I've been hearing a lot about Tellman's lamina library as a rich >>>> Clojure toolset for working with asynchronicity. I haven't had a need for >>>> it myself, but you might want to check it out and see if it has relevance >>>> to what you want to do. >>>> >>>> -- >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Clojure" group. >>>> To post to this group, send email to clo...@googlegroups.com<javascript:> >>>> Note that posts from new members are moderated - please be patient with >>>> your first post. >>>> To unsubscribe from this group, send email to >>>> clojure+u...@googlegroups.com <javascript:> >>>> 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 unsubscribe from this group and stop receiving emails from it, send >>>> an email to clojure+u...@googlegroups.com <javascript:>. >>>> For more options, visit https://groups.google.com/groups/opt_out. >>>> >>>> >>>> >>> >>> >> -- >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clo...@googlegroups.com<javascript:> >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> clojure+u...@googlegroups.com <javascript:> >> 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 unsubscribe from this group and stop receiving emails from it, send an >> email to clojure+u...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > > > -- > Telegram, Simply Beautiful CMS https://telegr.am > Lift, the simply functional web framework http://liftweb.net > Follow me: http://twitter.com/dpp > Blog: http://goodstuff.im > > -- -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.