From 41f0a6986276b1724f5833985cf2519be96cc463 Mon Sep 17 00:00:00 2001 From: Paul Tagliamonte Date: Tue, 2 Apr 2013 21:33:08 -0400 Subject: [PATCH] Add in a Python 3 hello world --- eg/python3/futures/hello-world.hy | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 eg/python3/futures/hello-world.hy diff --git a/eg/python3/futures/hello-world.hy b/eg/python3/futures/hello-world.hy new file mode 100644 index 0000000..3b031bc --- /dev/null +++ b/eg/python3/futures/hello-world.hy @@ -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)))