Add in a Python 3 hello world
This commit is contained in:
parent
9c3142f752
commit
41f0a69862
12
eg/python3/futures/hello-world.hy
Normal file
12
eg/python3/futures/hello-world.hy
Normal file
@ -0,0 +1,12 @@
|
||||
(import-from concurrent.futures ThreadPoolExecutor as-completed)
|
||||
(import-from random randint)
|
||||
|
||||
(import-from 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)))
|
Loading…
x
Reference in New Issue
Block a user