(subst (subst (subst (subst (subst ((if (zero? 0) + -) 3 4) [(monad-unit (\x x)) (monad-bind (\m (\f (f m)))) (monad-get (\state (cons state (cons state nil)))) (monad-set (\new-state (\state (cons #f (cons new-state nil))))) (monad-run (\m (\state (m state))))]) [(= (\m (\n (& (<= m n) (<= n m)))))]) [(<= (\m (\n (zero? (- m n)))))]) [(2 (succ 1)) (3 (succ (succ 1))) (4 (succ (succ (succ 1)))) (+ (\m(\n (m succ n)))) (* (\m(\n(\f (m (n f)))))) (** (\b(\e (e b)))) (- (\m(\n (n pred m)))) (zero? (\n ((n (\x #f)) #t))) (cons (\x (\y (\s ((s x) y))))) (nil (\x #t)) (nil? (\p (p (\x (\y #f))))) (head (\p (p #t))) (tail (\p (p #f))) ]) [(succ (\n(\f(\x (f (n f x)))))) (pred (\n(\f(\x(((n (\g(\h(h (g f))))) (\u x)) (\u u)))))) (1 (\ff(\xx (ff xx)))) (0 (\ff(\xx xx))) (#t (\x(\y x))) (#f (\x(\y y))) (& (\p(\q (p q p)))) (| (\p(\q (p p q)))) (if (\p(\a(\b (p a b))))) (I (\x x)) (K (\x (\y x))) (S (\x (\y (\z ((x z) (y z)))))) (Y (\f ((\x (f (x x))) (\x (f (x x)))))) (AY (\f ((\x (f (\arg ((x x) arg)))) (\x (f (\arg ((x x) arg)))))))]) (| #f #t) (head (cons nil)) => (tail (cons nil)) => nil (nil? nil) => #t (nil? (cons nil)) -> #f (monad-bind (monad-unit x) f) == (f x) (monad-bind M monad-unit) == M (monad-bind (monad-bind M f) g) == (monad-bind M (\ x (monad-bind (f x) g)))