aboutsummaryrefslogtreecommitdiffstats
path: root/research/experiments/030-app-lifecycle/items-same.aup
diff options
context:
space:
mode:
Diffstat (limited to 'research/experiments/030-app-lifecycle/items-same.aup')
-rw-r--r--research/experiments/030-app-lifecycle/items-same.aup46
1 files changed, 46 insertions, 0 deletions
diff --git a/research/experiments/030-app-lifecycle/items-same.aup b/research/experiments/030-app-lifecycle/items-same.aup
new file mode 100644
index 0000000..d1bb5f5
--- /dev/null
+++ b/research/experiments/030-app-lifecycle/items-same.aup
@@ -0,0 +1,46 @@
+record Pair {
+ n = 0
+ m = 0
+}
+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 > 1) + 2000
+view tally = hits + 500000
+view summed {
+ let t = 0
+ for i in items { t = t + i.n }
+ return t
+}
+view picked {
+ let ps: list of Pair
+ for i in items {
+ if i.n > 9 { ps.append(Pair { n: i.n, m: i.n * 2 }) }
+ }
+ let t = 0
+ for p in ps { t = t + p.m }
+ return t + 100000
+}