liveBook · Manning

Send

As explained in Clojure: The Essential Reference

send is a Clojure function that asynchronously dispatches an action function to an agent for execution on the fixed-size agent send pool.

send asynchronously dispatches an action function to an agent. The function receives the agent’s current value and produces its next value; actions execute sequentially on the agent’s send pool. section 14.6

Increment an agent

(def a (agent 0)) (send a inc) (deref a) ; 1 @(send a inc) ; 1 (deref a) ; 2

How Clojure: The Essential Reference covers it

How deep it goes
Explains the state-transition contract and demonstrates basic dispatch, but defers detailed executor customization to related functions.
Examples
Uses an agent initialized to zero, inc, send, deref, and nested dereferencing to show successive state changes.
What it assumes
Assumes familiarity with Clojure functions, agents, asynchronous execution, and dereferencing.
What you can do after
Apply send to queue state-changing functions on agents, then observe completion through deref or await.
How it connects
Connects agents with deref, await, send-off, and sequential action processing.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Clojure: The Essential Reference. The section links point to the parts of the book it draws on.