; Iter 15f — fourth consumer demo. Drives every std_pair combinator ; once. fst/snd are stable at 7/9; swap reverses; map_first/map_second ; demonstrate the Pair -> Pair / Pair reshape with ; b/a held rigid. (module std_pair_demo (import std_pair) (fn inc (doc "Add 1. Used as the (a -> c) arg.") (type (fn-type (params (con Int)) (ret (con Int)))) (params x) (body (app + x 1))) (fn double (doc "Multiply by 2. Used as the (b -> c) arg.") (type (fn-type (params (con Int)) (ret (con Int)))) (params x) (body (app * x 2))) (fn main (doc "Drive every combinator. Expected (per line): 7, 9, 9, 7, 8, 18.") (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body (seq (do io/print_int (app std_pair.fst (term-ctor std_pair.Pair MkPair 7 9))) (seq (do io/print_int (app std_pair.snd (term-ctor std_pair.Pair MkPair 7 9))) (seq (do io/print_int (app std_pair.fst (app std_pair.swap (term-ctor std_pair.Pair MkPair 7 9)))) (seq (do io/print_int (app std_pair.snd (app std_pair.swap (term-ctor std_pair.Pair MkPair 7 9)))) (seq (do io/print_int (app std_pair.fst (app std_pair.map_first inc (term-ctor std_pair.Pair MkPair 7 9)))) (do io/print_int (app std_pair.snd (app std_pair.map_second double (term-ctor std_pair.Pair MkPair 7 9))))))))))))