How do Clojure futures and promises differ?
问题 Both futures and promises block until they have calculated their values, so what is the difference between them? 回答1: Answering in Clojure terms, here are some examples from Sean Devlin's screencast: (def a-promise (promise)) (deliver a-promise :fred) (def f (future (some-sexp))) (deref f) Note that in the promise you are explicitly delivering a value that you select in a later computation ( :fred in this case). The future, on the other hand, is being consumed in the same place that it was