summaryrefslogtreecommitdiff
path: root/go/react/react.go
diff options
context:
space:
mode:
Diffstat (limited to 'go/react/react.go')
-rw-r--r--go/react/react.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/go/react/react.go b/go/react/react.go
index 3285f49..42a0737 100644
--- a/go/react/react.go
+++ b/go/react/react.go
@@ -5,13 +5,11 @@ const testVersion = 4
/* reactor */
type reactor struct {
- cells map[*compuCell]struct{}
+ cells []*compuCell
}
func New() Reactor {
- return &reactor{
- cells: make(map[*compuCell]struct{}),
- }
+ return &reactor{}
}
func (r *reactor) CreateCompute1(c Cell, f func(int) int) ComputeCell {
@@ -28,7 +26,7 @@ func (r *reactor) CreateCompute1(c Cell, f func(int) int) ComputeCell {
}
return v
}
- r.cells[cc] = struct{}{}
+ r.cells = append(r.cells, cc)
return cc
}
@@ -46,7 +44,7 @@ func (r *reactor) CreateCompute2(c1, c2 Cell, f func(int, int) int) ComputeCell
}
return v
}
- r.cells[cc] = struct{}{}
+ r.cells = append(r.cells, cc)
return cc
}
@@ -67,7 +65,7 @@ type inputCell struct {
func (c *inputCell) SetValue(i int) {
if c.value != i {
c.value = i
- for cc := range c.cells {
+ for _, cc := range c.cells {
cc.eval()
}
}