ConsumeOrMoveForwardList.yqls 1.4 KB

1234567891011121314151617181920212223242526272829
  1. (
  2. (let config (DataSource 'config))
  3. (import id_module '"/lib/yql/id.yql")
  4. (let id (bind id_module 'id))
  5. (let list (AsList (String 'a) (String 'b) (String 'c)))
  6. (let res_sink (DataSink 'result))
  7. (let world (Write! world res_sink (Key) (ForwardList (Iterator list (DependsOn (Int32 '0)))) '('('type))))
  8. (let world (Write! world res_sink (Key) (ForwardList (Apply id (Iterator list (DependsOn (Int32 '1))))) '('('type))))
  9. (let world (Write! world res_sink (Key) (Fold (ForwardList (Apply id (Iterator list (DependsOn (Int32 '2))))) (String '"")
  10. (lambda '(item state) (Concat item state))) '('('type))))
  11. (let world (Write! world res_sink (Key) (Fold1 (ForwardList (Apply id (Iterator list (DependsOn (Int32 '3)))))
  12. (lambda '(item) item)
  13. (lambda '(item state) (Concat item state))) '('('type))))
  14. (let world (Write! world res_sink (Key) (FlatMap (ForwardList (Apply id (Iterator list (DependsOn (Int32 '4)))))
  15. (lambda '(item) (AsList item item))) '('('type))))
  16. (let world (Write! world res_sink (Key) (FoldMap (ForwardList (Apply id (Iterator list (DependsOn (Int32 '5))))) (String '"")
  17. (lambda '(item state) '((Concat item state) (Concat item state)))) '('('type))))
  18. (let world (Write! world res_sink (Key) (Fold1Map (ForwardList (Apply id (Iterator list (DependsOn (Int32 '6)))))
  19. (lambda '(item) '(item item))
  20. (lambda '(item state) '((Concat item state) (Concat item state)))) '('('type))))
  21. (let world (Commit! world res_sink))
  22. (return world)
  23. )