That's basically all you need to know to write threads. The best way to get a good handle on them is just to experiment with some
strandio functions. For information on running threads from gall agents, see here and for some examples see here.
Now here's a quick recap of the main points covered:
- is the gall agent that manages threads.
- Details of interacting with threads via spider can be seen here.
- are like transient gall agents
- are used mostly to chain a series of IO operations
- can be used by gall agents to spin out IO operations
- live in the
- are managed by the gall agent
- take a
vaseand produce a
strandwhich produces a
/- spider =, strand=strand:spider ^- thread:spider |= arg=vase =/ m (strand ,vase) ^- form:m (pure:m arg)
- are the building blocks of threads
- take this input and produce this output.
- must be specialised to produce a particular type like
- are conventionally given the face
- are a core that has three main arms -
- is the mold of the strand suitable for casting
- is the type returned by the other arms
- simply returns the
strandthat produces pure's argument without doing any IO
- is used in conjunction with micgal (
- must be specialised to a type like
;< <type> bind:m ...
- takes two arguments. The first is a function that returns the
<type>. The second is a gate whose sample is
<type>and which returns a
- calls the first and then, if it succeeded, calls the second with the result of the first as its sample.
- looks like
[=bowl in=(unit input)]
bowlhas things like
enyand so forth
bowlis populated once when the thread is first called and then every time it receives new input
inputcontains any incoming pokes, signs and watches.
[cards=(list card:agent:gall) <response>]
cardsare any cards to be sent immediately
<response>is something like
[%fail err], etc.
%donewill contain the result
- responses are only used internally to manage the flow of the thread and are not returned to subscribers.
- is located in
- contains a collection of ready-made functions for use in threads