tvl-depot/tvix/eval/src/tests/tvix_tests/eval-okay-foldl.nix
Griffin Smith ba8ec1910b feat(tvix/eval): Implement builtins.foldl'
Change-Id: Ibc97db4343cb3a1a1677f69fb6c3518c61978aad
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6906
Autosubmit: grfn <grfn@gws.fyi>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2022-10-10 15:26:29 +00:00

5 lines
166 B
Nix

[
(builtins.foldl' builtins.add 0 [1 2 3])
(builtins.foldl' (l1: l2: l1 ++ l2) [0] [[1] [2 3]])
(builtins.foldl' (x: y: if x == 0 then y else x * y) 0 [1 2])
]