Re: [go-nuts] Tiny FSM

2017-09-24 Thread dc0d
I've done F# for some years before but it's not always very fruitful to apply practices from other domains. Also I've already implemented other version of the runner engine (the Activate method) for (as an example) handling a final state. But I've been discouraged from doing many things in Go,

Re: [go-nuts] Tiny FSM

2017-09-24 Thread Jesper Louis Andersen
This method is common in functional programming as well. You are, essentially, computing a fixed point over the state machine (or in Rob's example a lexer state). That is, you are taking a set of state transitions and turning them into a function when looked at from the "outside". If you have a

Re: [go-nuts] Tiny FSM

2017-09-24 Thread dc0d
Nice! At least I've not reinvented any wheel this time! Just rediscovered it! Thanks! On Sunday, September 24, 2017 at 12:43:51 PM UTC+3:30, Jan Mercl wrote: > > On Sun, Sep 24, 2017 at 11:07 AM dc0d > wrote: > > https://youtu.be/HxaD_trXwRE?t=14m7s > > -- > > -j >

Re: [go-nuts] Tiny FSM

2017-09-24 Thread Jan Mercl
On Sun, Sep 24, 2017 at 11:07 AM dc0d wrote: https://youtu.be/HxaD_trXwRE?t=14m7s -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an

[go-nuts] Tiny FSM

2017-09-24 Thread dc0d
What cons (or pros) there might be in this implementation? type State func() (State, error) func (s State) Activate() (funcErr error) { next := s for next != nil && funcErr == nil { next, funcErr = next() } return } type FSM interface { Start() State } - Calling it a FSM (Finite