Clojure future and promise — Simple Async with @deref and deliver | Episode 28
0views
C
CelesteAI
Description
Two small primitives that cover the most common async patterns. `future` takes a body and runs it on a background thread — you get a reference back, and `@` deref returns the body's value when it's ready. `promise` is an empty cell that any thread can `deliver` a value into — `@` blocks until someone does. Both are one-shot: once set, the value is fixed.