Here are the definitions pre-loaded for working on assignment 3: let true = \x y. x in let false = \x y. y in let and = \l r. l (r true false) false in let makePair = \f s g. g f s in let fst = true in let snd = false in let nil = makePair true meh in let isNil = \x. x fst in let makeList = \h t. makePair false (makePair h t) in let head = \l. isNil l err (l snd fst) in let tail = \l. isNil l err (l snd snd) in let mylist = makeList 1 (makeList 2 (makeList 3 nil)) in let Y = \f. (\h. f (h h)) (\h. f (h h)) in let isZero = \n. n (\x. false) true in let succ = \n s z. s (n s z) in let mult = \m n s. m (n s) in let length = Y (\length l. isNil l 0 (succ (length (tail l)))) in let pred = \n. isZero n 0 (length (tail (n (\p. makeList meh p) nil))) in let leq = \m n. isZero(n pred m) in let eq = \m n. and (leq m n)(leq n m) in ; length (tail mylist) do eta-reductions too You may not see it because you have JavaScript turned off. Uffff!
You may not see it because you have JavaScript turned off. Uffff!