# Lambda Lifting ```Scheme (define fact/k-helper (lambda (n cont val) (cont (* n val)))) (define fact/k (lambda (n cont) (if (zero? n) (cont 1) (fact/k (- n 1) (lambda (val) (fact/k-helper n cont val)))))) ``` --- ```Scheme (fact 3) = (fact/k 3 (end-cont)) = (fact/k 2 (lambda (val) (fact/k-helper 3 (end-cont) val))) = (fact/k 1 (lambda (val) (fact/k-helper 2 (lambda (val) (fact/k-helper 3 (end-cont) val)) val))) = (fact/k 0 (lambda (val) (fact/k-helper 1 (lambda (val) (fact/k-helper 2 (lambda (val) (fact/k-helper 3 (end-cont) val)) val)) val))) = (fact/k-helper 1 (lambda (val) (fact/k-helper 2 (lambda (val) (fact/k-helper 3 (end-cont) val)) val)) 1) = (fact/k-helper 2 (lambda (val) (fact/k-helper 3 (end-cont) val)) 1) = (fact/k-helper 3 (end-cont) 2) = (end-cont (* 3 2)) = 6 ```