On 20 October 2010 20:23, Alan <a...@malloys.org> 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.

I did some more playing and it memoizes the returned value too. :)


-- 
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 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

Reply via email to