aboutsummaryrefslogtreecommitdiffstats
path: root/research/experiments/030-app-lifecycle/items-next.aup
blob: 7a1917a8361997ad2918dd1217f9dbc3a1ecf2ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
record Item {
  n = 0
}
state items: list of Item
state more: list of Item
state hits = 0
input seed = message { n: number }
input grow = message { step: number }
input add = message { step: number }
on seed {
  items.append(Item { n: seed.n })
}
on grow {
  for i in items {
    more.append(Item { n: i.n + grow.step })
  }
  for m in more {
    items.append(Item { n: m.n })
  }
  for m in more {
    more.remove(m)
  }
}
on add {
  hits = hits + add.step
}
view count = count(i in items where i.n > 0)
view total = hits
view size = count(i in items where i.n >= 0)