Seq.yqls 928 B

123456789101112131415161718192021222324252627282930
  1. (
  2. (let config (DataSource 'config))
  3. (let res_sink (DataSink 'result))
  4. (let v1 (String 'test1))
  5. (let q1 (QueueCreate (TypeOf v1) (Uint64 '1) (Uint64 '1) (DependsOn v1)))
  6. (let new_q1 (QueuePush (QueuePop q1) v1))
  7. (let q1_item (QueuePeek q1 (Uint64 '0) (DependsOn v1)))
  8. (let new_q1_item (QueuePeek new_q1 (Uint64 '0) (DependsOn v1)))
  9. # will be (test1, test1)
  10. (let result '(new_q1_item q1_item))
  11. (let world (Write! world res_sink (Key) result '('('type))))
  12. (let v2 (String 'test2))
  13. (let q2 (QueueCreate (TypeOf v2) (Uint64 '1) (Uint64 '1) (DependsOn v2)))
  14. (let new_q2 (QueuePush (QueuePop q2) v2))
  15. (let q2_item (QueuePeek q2 (Uint64 '0) (DependsOn v2)))
  16. (let new_q2_item (QueuePeek new_q2 (Uint64 '0) (DependsOn v2)))
  17. # enforce q2_item to be calculated first
  18. (let result '((Seq q2_item new_q2_item) q2_item))
  19. (let world (Write! world res_sink (Key) result '('('type))))
  20. (let world (Commit! world res_sink))
  21. (return world)
  22. )