diff --git a/README b/README index 7ac595c..c09a49f 100644 --- a/README +++ b/README @@ -21,6 +21,18 @@ geister.core> @*1 7 geister.core> +async-loop: +like clojure's built in loop. use async-recur instead of recur. each loop iteration +is queued up as a seperate async task. +geister.core> (async-loop [[x & xs] (range 10) t 0] + (if x + (async-recur xs (+ x t)) + t)) +geister.core.Task@90ce3f54 +geister.core> @*1 +45 +geister.core> + async tasks are chainable: geister.core> (chain (task (+ 1 2)) (fn [x] (task (inc x)))) geister.core.Task@aadbba2f @@ -35,6 +47,18 @@ geister.core> @*1 (3 7) geister.core> +exceptions are propagated through chains of async tasks. if you deref an async task +and any async tasks that it depended on threw an exception, then that exception will +be thrown. +geister.core> (async [x (task "foo") + y (task (+ 1 2))] + (+ y x)) +geister.core.Task@463b2d3c +geister.core> (try @*1 (catch Exception e (println e))) +# +nil +geister.core> + by default tasks are queued on clojure's pooledExecutor (same as send). you can rebind *task-handler* to change how and where async tasks are executed.