Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLinear ¶
func NewLinear(root token.Token) (chan struct{}, chan<- ReduceFeedbackType, error)
NewLinear implements a reduce strategy that reduces the data through a linear search algorithm. Every step of the strategy generates a new valid token graph state. The generation is deterministic. The algorithm starts by deactivating all optional tokens, this includes for example reducing lists to their minimum repetition. Each step uses the feedback to determine which tokens to reactivate next.
Types ¶
type ReduceFeedbackType ¶
type ReduceFeedbackType int
ReduceFeedbackType the reduce strategy feedback type
const ( // Unknown the feedback is of unknown type, this is always a fatal error Unknown ReduceFeedbackType = iota // Good the reduce step produced a successful result Good // Bad the reduce step produced an unsuccessful result Bad )
func (ReduceFeedbackType) String ¶
func (i ReduceFeedbackType) String() string
type Strategy ¶
type Strategy func(root token.Token) (chan struct{}, chan<- ReduceFeedbackType, error)
Strategy defines a reduce strategy The function starts the first step of the reduce strategy returning a channel which controls the step flow and a channel for the feedback of the step. The channel returns a value if the step is complete and waits with calculating the next step until a value is put in and feedback is given. The channels are automatically closed when there are no more steps. The error return argument is not nil if an error occurs during the initialization of the reduce strategy.