Bend/tests/snapshots/parse_file__imp_program.bend.snap
2024-05-28 16:49:00 -03:00

68 lines
2.7 KiB
Plaintext

---
source: tests/golden_tests.rs
input_file: tests/golden_tests/parse_file/imp_program.bend
---
(Map/empty) = Map/Leaf
(Map/get) = λ%arg0 λ%arg1 use key = %arg1; use map = %arg0; match map = map { Map/Leaf: (*, map); Map/Node: switch _ = (== 0 key) { 0: switch _ = (% key 2) { 0: let (got, rest) = (Map/get map.left (/ key 2)); (got, (Map/Node map.value rest map.right)); _ _-1: let (got, rest) = (Map/get map.right (/ key 2)); (got, (Map/Node map.value map.left rest)); }; _ _-1: (map.value, map); }; }
(Map/set) = λ%arg0 λ%arg1 λ%arg2 use value = %arg2; use key = %arg1; use map = %arg0; match map = map { Map/Node: switch _ = (== 0 key) { 0: switch _ = (% key 2) { 0: (Map/Node map.value (Map/set map.left (/ key 2) value) map.right); _ _-1: (Map/Node map.value map.left (Map/set map.right (/ key 2) value)); }; _ _-1: (Map/Node value map.left map.right); }; Map/Leaf: switch _ = (== 0 key) { 0: switch _ = (% key 2) { 0: (Map/Node * (Map/set Map/Leaf (/ key 2) value) Map/Leaf); _ _-1: (Map/Node * Map/Leaf (Map/set Map/Leaf (/ key 2) value)); }; _ _-1: (Map/Node value Map/Leaf Map/Leaf); }; }
(symbols) = let x = (Map/set (Map/set Map/empty 49 5) 2 3); let x = (Map/set x 49 2); let x = (Map/set x 2 3); let (map/get%0, x) = (Map/get x 49); (+ map/get%0 8293490)
(mk_point) = (Point/Point 1 2)
(identity) = λ%arg0 use x = %arg0; x
(inc) = λ%arg0 use n = %arg0; let n = (+ n 1); n
(inc_list) = λ%arg0 use list = %arg0; fold %iter = list { List/Nil: List/Nil; List/Cons: let x = %iter.head; (List/Cons (+ x 1) %iter.tail); }
(lam) = λx λy x
(do_match) = λ%arg0 use b = %arg0; match b = b { Bool/True: 1; Bool/False: 0; }
(true) = Bool/True
(fib) = λ%arg0 use n = %arg0; switch %pred = (< n 2) { 0: (+ (fib (- n 1)) (fib (- n 2))); _ %pred-1: n; }
(swt) = λ%arg0 use n = %arg0; switch n = n { 0: 42; _ n-1: 1; }
(fld) = λ%arg0 use list = %arg0; fold list = list { List/Cons: 1; List/Nil: 2; }
(bnd) = bend x = 0, { when (< x 10): (List/Cons x (fork (+ x 1))); else: List/Nil }
(era) = let * = (+ 2 3); let the_expr_killer = *; (the_expr_killer 9)
(sup) = let x = {(List/Cons 1 (List/Cons 2 List/Nil)) (List/Cons 3 (List/Cons 4 (List/Cons 5 (List/Cons 6 List/Nil))))}; x
(main) = with IO { ask x = IO.read; x }
(List/Nil) = λ%x (%x List/Nil/tag)
(List/Cons) = λhead λtail λ%x (%x List/Cons/tag head tail)
(Map/Node) = λvalue λleft λright λ%x (%x Map/Node/tag value left right)
(Map/Leaf) = λ%x (%x Map/Leaf/tag)
(Point/Point) = λx λy λ%x (%x Point/Point/tag x y)
(Bool/True) = λ%x (%x Bool/True/tag)
(Bool/False) = λ%x (%x Bool/False/tag)
(List/Nil/tag) = 0
(List/Cons/tag) = 1
(Map/Node/tag) = 0
(Map/Leaf/tag) = 1
(Point/Point/tag) = 0
(Bool/True/tag) = 0
(Bool/False/tag) = 1