Skip to content

Commit 0a49c7a

Browse files
committed
formatting
1 parent 55580a4 commit 0a49c7a

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

doc/flow-guide.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Step functions have four arities:
1212

1313
<a href="https://github.com/clojure/core.async/blob/master/doc/img/step-fn-arities.png?raw=true"><img src="https://github.com/clojure/core.async/blob/master/doc/img/step-fn-arities.png?raw=true" alt="step-fn arities" width="700"/></a>
1414

15-
### describe: (step-fn) -> descriptor
15+
### describe: `(step-fn) -> descriptor`
1616

1717
The describe arity must return a static description of the step-fn's :params, :ins, and :outs. Each of these is a map of name (a keyword) to docstring.
1818

@@ -26,17 +26,17 @@ For example, the describe arity might return this description for a simple step-
2626

2727
The names used for input and output channels should be distinct (no overlap).
2828

29-
### init: (step-fn arg-map) -> init-state
29+
### init: `(step-fn arg-map) -> init-state`
3030

3131
The init arity is called once by the process to takes a set of args from the flow def (corresponding to the params returned from the describe arity) and returns the init state of the process.
3232

33-
### transition: (step-fn state transition) -> state'
33+
### transition: `(step-fn state transition) -> state'`
3434

3535
The transition arity is called any time the flow or process undergoes a lifecycle transition (::flow/start, ::flow/stop, ::flow/pause, ::flow/resume). The description arity takes the current state and returns an updated state to be used for subsequent calls.
3636

3737
The step-fn should use the transition arity to coordinate the creation, pausing, and shutdown of external resources in a process.
3838

39-
### transform: (step-fn state input msg) -> [state' {out-id [msgs]}]
39+
### transform: `(step-fn state input msg) -> [state' {out-id [msgs]}]`
4040

4141
The transform arity is called in a loop by the process for every message received on an input channel and returns a new state and a map of output cids to messages to return. The process will take care of sending these messages to the output channels. Output can be sent to none, any or all of the :outsenumerated, and/or an input named by a [pid inid] tuple (e.g. for reply-to), and/or to the ::flow/report output. A step need not output at all (output or msgs can be empyt/nil), however an output _message_ may never be nil (per core.async channels).
4242

docs/flow-guide.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ <h2><a href="#step-fns-and-process-launchers" id="step-fns-and-process-launchers
77
<p>You provide logic to flow in the form of <em>step-fns</em>, which are wrapped into running processes, executing in a loop. Flow manages the life cycle of the process and handles incoming and outgoing messages by putting or taking them on channels. Step-fns do not access channels directly or hold state, making them easy to test in isolation and reuse.</p>
88
<p>Step functions have four arities:</p>
99
<p><a href="https://github.com/clojure/core.async/blob/master/doc/img/step-fn-arities.png?raw=true"><img src="https://github.com/clojure/core.async/blob/master/doc/img/step-fn-arities.png?raw=true" alt="step-fn arities" width="700" /></a></p>
10-
<h3><a href="#describe-step-fn-descriptor" id="describe-step-fn-descriptor"></a>describe: (step-fn) -&gt; descriptor</h3>
10+
<h3><a href="#describe-step-fn-descriptor" id="describe-step-fn-descriptor"></a>describe: <code>(step-fn) -&gt; descriptor</code></h3>
1111
<p>The describe arity must return a static description of the step-fn’s :params, :ins, and :outs. Each of these is a map of name (a keyword) to docstring.</p>
1212
<p>For example, the describe arity might return this description for a simple step-fn:</p>
1313
<pre><code class="language-clojure">{:params {:size "Max size"} ;; step-fn params
1414
:ins {:in "Input channel"} ;; input channels
1515
:outs {:out "Output channel"}} ;; output channels
1616
</code></pre>
1717
<p>The names used for input and output channels should be distinct (no overlap).</p>
18-
<h3><a href="#init-step-fn-arg-map-init-state" id="init-step-fn-arg-map-init-state"></a>init: (step-fn arg-map) -&gt; init-state</h3>
18+
<h3><a href="#init-step-fn-arg-map-init-state" id="init-step-fn-arg-map-init-state"></a>init: <code>(step-fn arg-map) -&gt; init-state</code></h3>
1919
<p>The init arity is called once by the process to takes a set of args from the flow def (corresponding to the params returned from the describe arity) and returns the init state of the process.</p>
20-
<h3><a href="#transition-step-fn-state-transition-state" id="transition-step-fn-state-transition-state"></a>transition: (step-fn state transition) -&gt; state</h3>
20+
<h3><a href="#transition-step-fn-state-transition-state" id="transition-step-fn-state-transition-state"></a>transition: <code>(step-fn state transition) -&gt; state'</code></h3>
2121
<p>The transition arity is called any time the flow or process undergoes a lifecycle transition (::flow/start, ::flow/stop, ::flow/pause, ::flow/resume). The description arity takes the current state and returns an updated state to be used for subsequent calls.</p>
2222
<p>The step-fn should use the transition arity to coordinate the creation, pausing, and shutdown of external resources in a process.</p>
23-
<h3><a href="#transform-step-fn-state-input-msg-state-out-id-msgs" id="transform-step-fn-state-input-msg-state-out-id-msgs"></a>transform: (step-fn state input msg) -&gt; [state {out-id <a href="msgs">msgs</a>}]</h3>
23+
<h3><a href="#transform-step-fn-state-input-msg-state-out-id-msgs" id="transform-step-fn-state-input-msg-state-out-id-msgs"></a>transform: <code>(step-fn state input msg) -&gt; [state' {out-id [msgs]}]</code></h3>
2424
<p>The transform arity is called in a loop by the process for every message received on an input channel and returns a new state and a map of output cids to messages to return. The process will take care of sending these messages to the output channels. Output can be sent to none, any or all of the :outsenumerated, and/or an input named by a <a href="pid inid">pid inid</a> tuple (e.g. for reply-to), and/or to the ::flow/report output. A step need not output at all (output or msgs can be empyt/nil), however an output <em>message</em> may never be nil (per core.async channels).</p>
2525
<p>The step-fn may throw excepitons from any arity and they will be handled by flow. Exceptions thrown from the transition or transform arities, the exception will be logged on the flow’s :error-chan.</p>
2626
<h3><a href="#process-state" id="process-state"></a>Process state</h3>

0 commit comments

Comments
 (0)