Fork me on GitHub
#clojure
<
2021-11-20
>
slipset20:11:59

From the docstring of delay we see "...that will invoke the body only the first time it is forced (with force or deref/@)..." So the question is: is there a difference between using force and deref?

phronmophobic20:11:25

seems like the main difference is if want to use it with a value that may or may not be a delay:

> (force 42)
42
> (deref 42)
Execution error (ClassCastException)  (REPL:955).

p-himik20:11:13

force is deref conditioned on x instanceof Delay.