;;;; A generic copy first made while an if's else arm is tried on its own, ;;;; then kept when the arm is checked again: whatever the copy lifted — a ;;;; lambda, a condition's message printer — has to be kept with it, or the ;;;; program links against a function nobody emitted. (defstruct MyErr :parent Error [code i32 why str]) (defn ap [x i32 f (Fn [i32] i32)] i32 (f x)) (defn g [x $t] i32 (ap 21 (fn [y] (+ y y)))) (defn h [x $t] i32 (when (< 21 0) (error (MyErr {.code 3 .why "negative"}))) 21) (defn pick [c bool a i64 b i32] i64 (let [v (if c a (g b))] v)) (defn pick2 [c bool a i64 b i32] i64 (let [v (if c a (h b))] v)) (defn main [] i32 (println (pick false 1 21)) (println (pick2 false 1 21)) 0)