Async docs

This commit is contained in:
Michiel Borkent 2020-03-01 16:56:28 +01:00
parent 24a469af65
commit 1a5100ad32

View file

@ -186,8 +186,7 @@ enumerated explicitly.
`make-parents`, `output-stream`, `reader`, `resource`, `writer`
- `clojure.main`: `repl`
- [`clojure.core.async`](https://clojure.github.io/core.async/) aliased as
`async`. The `alt` and `go` macros are not available but `alts!!` does work as
it is a function.
`async`.
- `clojure.stacktrace`
- `clojure.test`
- `clojure.pprint`: `pprint` (currently backed by [fipp](https://github.com/brandonbloom/fipp)'s `fipp.edn/pprint`)
@ -606,10 +605,10 @@ Also see this [example](examples/process_builder.clj).
## Async
Apart from `future` and `pmap` for creating threads, you may use the `async`
namespace, which maps to `clojure.core.async`, for asynchronous scripting. The
following example shows how to get first available value from two different
processes:
Apart from `future` and `pmap` for creating threads, you may use the
`clojure.core.async` namespace, aliases as `async`, for asynchronous
scripting. The following example shows how to get first available value from two
different processes:
``` clojure
bb '
@ -622,6 +621,11 @@ bb '
process 2
```
Note: the `go` macro is available for compatibility with JVM programs, but the
implementation maps to `clojure.core.async/thread` and the single exclamation
mark operations (`<!`, `>!`, etc.) map to with the double exclamation mark
operations (`<!!`, `>!!`, etc.). It will not `park` threads, like on the JVM.
## HTTP
For making HTTP requests you can use: