2023-11-29 20:45:52 +03:00
|
|
|
---
|
|
|
|
source: tests/golden_tests.rs
|
2024-05-15 01:25:46 +03:00
|
|
|
input_file: tests/golden_tests/encode_pattern_match/list_merge_sort.bend
|
2023-11-29 20:45:52 +03:00
|
|
|
---
|
2024-05-18 15:01:20 +03:00
|
|
|
Scott
|
2024-05-29 10:15:13 +03:00
|
|
|
(If) = λa (a λb λc let * = c; b λf λg let * = f; g)
|
2024-02-07 18:19:07 +03:00
|
|
|
|
2024-05-10 22:42:32 +03:00
|
|
|
(Pure) = λa (List_/Cons a List_/Nil)
|
2024-02-07 18:19:07 +03:00
|
|
|
|
2024-05-29 10:15:13 +03:00
|
|
|
(Map) = λa (a λb λc λd let {e e_2} = d; (List_/Cons (e b) (Map c e_2)) λf let * = f; List_/Nil)
|
2024-02-07 18:19:07 +03:00
|
|
|
|
2024-02-13 22:34:32 +03:00
|
|
|
(MergeSort) = λa λb (Unpack a (Map b Pure))
|
2024-02-07 18:19:07 +03:00
|
|
|
|
2024-05-10 22:42:32 +03:00
|
|
|
(Unpack) = λa λb (b λc λd λe (d λf λg λh let {h h_2} = h; λi (Unpack h (MergePair h_2 (List_/Cons i (List_/Cons f g)))) λ* λk k e c) λ* List_/Nil a)
|
2024-02-07 18:19:07 +03:00
|
|
|
|
2024-05-10 22:42:32 +03:00
|
|
|
(MergePair) = λa λb (b λc λd λe (d λf λg λh let {h h_2} = h; λi (List_/Cons (Merge h i f) (MergePair h_2 g)) λ* λk (List_/Cons k List_/Nil) e c) λ* List_/Nil a)
|
2024-02-07 18:19:07 +03:00
|
|
|
|
2024-05-29 10:15:13 +03:00
|
|
|
(Merge) = λa λb (b λc λd λe λf (f λh let {h h_2 h_3} = h; λi let {i i_2} = i; λj let {j j_2 j_3} = j; λk let {k k_2 k_3} = k; λl let {l l_2} = l; (If (j k h) (List_/Cons k_2 (Merge j_2 l (List_/Cons h_2 i))) (List_/Cons h_3 (Merge j_3 (List_/Cons k_3 l_2) i_2))) λ* λp λq (List_/Cons p q) e c d) λ* λs s a)
|
2024-02-07 18:19:07 +03:00
|
|
|
|
2024-05-10 22:42:32 +03:00
|
|
|
(Bool/True) = λa λ* a
|
2024-02-07 18:19:07 +03:00
|
|
|
|
2024-05-10 22:42:32 +03:00
|
|
|
(Bool/False) = λ* λb b
|
2024-02-07 18:19:07 +03:00
|
|
|
|
2024-05-10 22:42:32 +03:00
|
|
|
(List_/Cons) = λa λb λc λ* (c a b)
|
2024-03-19 20:37:30 +03:00
|
|
|
|
2024-05-10 22:42:32 +03:00
|
|
|
(List_/Nil) = λ* λb b
|
2024-05-18 15:01:20 +03:00
|
|
|
|
|
|
|
NumScott
|
2024-05-29 10:15:13 +03:00
|
|
|
(If) = λa (a λb switch b { 0: λc λd let * = d; c; _: λ* λg λh let * = g; h; })
|
2024-05-18 15:01:20 +03:00
|
|
|
|
|
|
|
(Pure) = λa (List_/Cons a List_/Nil)
|
|
|
|
|
2024-05-29 10:15:13 +03:00
|
|
|
(Map) = λa (a λb switch b { 0: λc λd λe let {f f_2} = e; (List_/Cons (f c) (Map d f_2)); _: λ* λg let * = g; List_/Nil; })
|
2024-05-18 15:01:20 +03:00
|
|
|
|
|
|
|
(MergeSort) = λa λb (Unpack a (Map b Pure))
|
|
|
|
|
|
|
|
(Unpack) = λa λb (b λc switch c { 0: λd λe λf (e λg switch g { 0: λh λi λj let {j j_2} = j; λk (Unpack j (MergePair j_2 (List_/Cons k (List_/Cons h i)))); _: λ* λ* λm m; } f d); _: λ* λ* List_/Nil; } a)
|
|
|
|
|
|
|
|
(MergePair) = λa λb (b λc switch c { 0: λd λe λf (e λg switch g { 0: λh λi λj let {j j_2} = j; λk (List_/Cons (Merge j k h) (MergePair j_2 i)); _: λ* λ* λm (List_/Cons m List_/Nil); } f d); _: λ* λ* List_/Nil; } a)
|
|
|
|
|
2024-05-29 10:15:13 +03:00
|
|
|
(Merge) = λa λb (b λc switch c { 0: λd λe λf λg (g λi switch i { 0: λj let {j j_2 j_3} = j; λk let {k k_2} = k; λl let {l l_2 l_3} = l; λm let {m m_2 m_3} = m; λn let {n n_2} = n; (If (l m j) (List_/Cons m_2 (Merge l_2 n (List_/Cons j_2 k))) (List_/Cons j_3 (Merge l_3 (List_/Cons m_3 n_2) k_2))); _: λ* λ* λr λs (List_/Cons r s); } f d e); _: λ* λ* λu u; } a)
|
2024-05-18 15:01:20 +03:00
|
|
|
|
2024-05-27 21:09:23 +03:00
|
|
|
(Bool/True) = λa (a Bool/True/tag)
|
2024-05-18 15:01:20 +03:00
|
|
|
|
2024-05-27 21:09:23 +03:00
|
|
|
(Bool/False) = λa (a Bool/False/tag)
|
2024-05-18 15:01:20 +03:00
|
|
|
|
2024-05-27 21:09:23 +03:00
|
|
|
(List_/Cons) = λa λb λc (c List_/Cons/tag a b)
|
2024-05-18 15:01:20 +03:00
|
|
|
|
2024-05-27 21:09:23 +03:00
|
|
|
(List_/Nil) = λa (a List_/Nil/tag)
|
|
|
|
|
|
|
|
(Bool/True/tag) = 0
|
|
|
|
|
|
|
|
(Bool/False/tag) = 1
|
|
|
|
|
|
|
|
(List_/Cons/tag) = 0
|
|
|
|
|
|
|
|
(List_/Nil/tag) = 1
|