2024-04-03 18:53:45 +03:00
---
source: tests/golden_tests.rs
2024-05-15 01:25:46 +03:00
input_file: tests/golden_tests/simplify_matches/linearize_match_all.bend
2024-04-03 18:53:45 +03:00
---
2024-04-22 14:20:47 +03:00
(A) = λa switch a { 0: λb λc (b c); _ d: λe λf (d e f); }
2024-04-03 18:53:45 +03:00
2024-04-22 14:20:47 +03:00
(B) = λa λb λc (switch c { 0: λd λe (d e); _ f: λg λh (g h f); } a b)
2024-04-03 18:53:45 +03:00
2024-04-22 14:20:47 +03:00
(C) = λa λb λc switch c { 0: (a b); _ d: (a b d); }
2024-04-03 18:53:45 +03:00
2024-04-22 14:20:47 +03:00
(D) = λa switch a { 0: λb λc c; _ d: λe λf (d f); }
2024-04-03 18:53:45 +03:00
2024-05-29 10:15:13 +03:00
(E) = λa match a { ConsList/Cons b c: λd let e = d; (match e { ConsList/Cons f g: λh λi (h i f g); ConsList/Nil: λj λk (ConsList/Cons j k ConsList/Nil); } b c); ConsList/Nil: λl let m = l; (ConsList/Nil m); }
2024-04-03 18:53:45 +03:00
2024-05-10 22:42:32 +03:00
(A2) = λa match a { ConsList/Cons b c: λd λe (b c d e); ConsList/Nil: λf λg (f g); }
2024-04-03 18:53:45 +03:00
2024-05-10 22:42:32 +03:00
(B2) = λa λb λc (match c { ConsList/Cons d e: λf λg (f g d e); ConsList/Nil: λh λi (h i); } a b)
2024-04-03 18:53:45 +03:00
2024-05-10 22:42:32 +03:00
(C2) = λa λb λc match c { ConsList/Cons d e: (a b d e); ConsList/Nil: (a b); }
2024-04-03 18:53:45 +03:00
2024-05-10 22:42:32 +03:00
(D2) = λa match a { ConsList/Cons b c: λd λe (b c d e); ConsList/Nil: λf λg (f g); }
2024-04-03 18:53:45 +03:00
(main) = *
2024-05-27 21:09:23 +03:00
(ConsList/Cons) = λa λb λc (c ConsList/Cons/tag a b)
2024-04-03 18:53:45 +03:00
2024-05-27 21:09:23 +03:00
(ConsList/Nil) = λa (a ConsList/Nil/tag)
(ConsList/Cons/tag) = 0
(ConsList/Nil/tag) = 1