thread-pool/parallel
src/thread-pool/parallel.tur
fan-out convenience over futures (FUT-V0.3).
Since: TP2
defopaque
TList
(TList [A] :int))
a phantom-typed singly-linked list view. Lowers to :int -- the
Since: TP2
defn
tlist-nil
(tlist-nil [A])
the empty (TList A).
Since: TP2
defn
tlist-cons
(tlist-cons [A])
prepend `h` to `t` (allocates one cons cell).
Since: TP2
defn
tlist-empty?
(tlist-empty? [A])
is this (TList A) the empty list?
Since: TP2
defn
tlist-head
(tlist-head [A])
the first element (undefined on the empty list).
Since: TP2
defn
tlist-tail
(tlist-tail [A])
everything after the first element.
Since: TP2
defn
pool-map
(pool-map [T R])
submit every item as a future, await all, return the results.
Parameters
| pool | borrowed (Pool T) handle. | |
| items | a (TList T) of work items (each consumed by the pool). | |
| work | (fn [T] R) run on a worker for each item. |
Returns
A (TList R) of results, in the same order as `items`.
Example
(pool-map pool (tlist-cons 1 (tlist-cons 2 (tlist-nil))) square) ; => (TList int) of [1 4]
Since: TP2