How to prevent an unconfirmed promise from being hung?
Here's an example from clojure for the brave and the true:
(time
(let [butter-promise (promise)]
(doseq [butter [yak-butter-international butter-than-nothing baby-got-yak]]
(future (if-let [satisfactory-butter (satisfactory? (mock-api-call butter))]
(deliver butter-promise satisfactory-butter))))
(println "And the winner is:" @butter-promise)))
What if none of the petroleum products meet our criteria?
+3
source to share