blob: 3a0c673d27e8a3561bf5b6454dad11e262a2c297 (
plain) (
blame)
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
30
31
32
|
(
(let config (DataSource 'config))
(let world (Configure! world config 'PureDataSource 'yt))
(let res_sink (DataSink 'result))
(let list (AsList
(Uint32 '1)
(Uint32 '1)
(Uint32 '2)
(Uint32 '3)
(Uint32 '5)
(Uint32 '8)
))
(let base_stream (Iterator list))
(let queue (QueueCreate (ListItemType (TypeOf list)) (Void) (Uint64 '0)))
(let stream (PreserveStream base_stream queue (Uint64 '100500)))
(let update (lambda '(item state) (block '(
(let cumulative_sum (+ item state))
(let queue_content (Collect (QueueRange queue (Uint64 '0) (Uint64 '100500) (DependsOn item))))
(return '('(item cumulative_sum queue_content) cumulative_sum))
))))
(let result (FoldMap stream (Uint32 '0) update))
(let world (Write! world res_sink (Key) (Collect result) '('('type))))
(let world (Commit! world res_sink))
(return world)
)
|