Hi Patrick,

If that really annoys you, you can tell the repl to display Delay instances
as dumb objects:
(defmethod print-method clojure.lang.Delay [x w] ((get-method print-method
Object) x w))

user=> (defmethod print-method clojure.lang.Delay [x w] ((get-method
print-method Object) x w))
#<MultiFn clojure.lang.mult...@1f6d156>
user=> (def del (delay (println "printed") (+ 2 3)))
#'net.cgrand.parsley/del
user=> del
#<Delay clojure.lang.de...@3e090f>
user=> (force del) ; note that @del would be equivalent here
printed
5

Christophe

On Mon, Sep 21, 2009 at 5:53 PM, patrickdlogan <patrickdlo...@gmail.com>wrote:

>
> I expected a delay only to be forced by an explicit call to force.
> instead it looks like, being a kind of IDeref, a delay will be forced
> by the REPL.
>
> e.g.
>
> user=> (def del (delay (println "printed") (+ 2 3)))
> #'user/del
> user=> del
> printed
> #<de...@8691dee: 5>
> user=> (force del)
> 5
>
> The documentation seems to imply the only way to force a delay is
> through the force procedure...
>
> " Takes a body of expressions and yields a Delay object that will
>  invoke the body only the first time it is forced (with force), and
>  will cache the result and return it on all subsequent force
>  calls."
>
> >
>


-- 
Professional: http://cgrand.net/ (fr)
On Clojure: http://clj-me.blogspot.com/ (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
-~----------~----~----~----~------~----~------~--~---

Reply via email to