Skip to content

Instantly share code, notes, and snippets.

@tomjack

tomjack/test.clj Secret

Created July 21, 2010 06:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomjack/7108adefc34f7ff2ea73 to your computer and use it in GitHub Desktop.
Save tomjack/7108adefc34f7ff2ea73 to your computer and use it in GitHub Desktop.
(defn mix-promise [& functions]
(fn [& args]
(let [result (promise)
futures (doall (for [fun functions]
(future (deliver result (apply fun args)))))
answer @result]
(dorun (map future-cancel futures))
answer)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment