You can use @x as shorthand for (force x) too, since delays implement IDeref.
On Oct 20, 1:25 pm, Paul Richards <[email protected]> wrote: > On 20 October 2010 21:21, Paul Richards <[email protected]> wrote: > > > > > On 20 October 2010 20:45, Paul Richards <[email protected]> wrote: > >> On 20 October 2010 20:23, Alan <[email protected]> wrote: > >>> Augh no, future is not lazy; it's for multithreading. Try delay - it's > >>> identical to the (suspend) given by the OP. > > >>> user=> (time (def x (delay (Thread/sleep 10000)))) > >>> "Elapsed time: 0.256312 msecs" > >>> #'user/x > >>> user=> (time (force x)) > >>> "Elapsed time: 10000.19261 msecs" > > >> This is perfect! Thank you. > > > The only missing feature is that these aren't automatically forced by > > "println" and friends in the same way that lazy sequences are.. The > > force is explicit (which is nice for clarity really), but a pain when > > printing. > > Please ignore this, I was printing the wrong thing. The delay objects > print perfectly and show their forced values. > > Apologies, > > -- > Paul Richards > @pauldoo -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
