hy/eg/python3/futures/hello-world.hy
Julien Danjou 27e74d43b1 Re-indent Hy code using hy-mode
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-28 16:31:31 +02:00

12 lines
332 B
Hy

(import [concurrent.futures [ThreadPoolExecutor as-completed]]
[random [randint]]
[sh [sleep]])
(defn task-to-do [] (sleep (randint 1 5)))
(with-as (ThreadPoolExecutor 10) executor
(setf jobs (list-comp (.submit executor task-to-do) (x (range 0 10))))
(for (future (as-completed jobs))
(.result future)))