Created
October 29, 2010 03:37
-
-
Save ohpauleez/652858 to your computer and use it in GitHub Desktop.
futures
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user=> (future (+ 1 2 3)) | |
#<core$future_call$reify__5403@d2d58b: 6> | |
user=> (def f *1) | |
#'user/f | |
user=> @f | |
6 | |
user=> (map #(future (apply * %)) (partition-all (+ 2 num-of-cores) (range 25))) | |
(#<core$future_call$reify__5403@3d3c33b7: 0> #<core$future_call$reify__5403@3b6752c9: 840> #<core$future_call$reify__5403@7c6c2896: 7920> #<core$future_call$reify__5403@20dccfab: 32760> #<core$future_call$reify__5403@c5f468: 93024> #<core$future_call$reify__5403@4430d83d: 212520> #<core$future_call$reify__5403@62c4afc4: 24>) | |
user=> (def my-futures *1) | |
#'user/my-futures | |
user=> (map #(deref %) my-futures) | |
(0 840 7920 32760 93024 212520 24) | |
user=> ; *1 is shorthand for the last returned value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment