494bf0e8ad
The new and improved (import) can handle all cases import-as and import-from did, so drop the latter two from the language. To do this, the import builtin had to be changed a little: if there's a single import statement to return, return it as-is, otherwise return a list of imports. Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
12 lines
353 B
Hy
12 lines
353 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)))
|