(load "~mc27/labs/quilting/quilting.scm")
(define factorial
(lambda (n)
(define product-with-range ; given integers x, and l computes
(lambda (x l) ; x * (all integers k such that l <= k <= n)
(if (> l n)
x
(product-with-range (* x l) (+ l 1)))))
(product-with-range 1 2)))
(define repeatedly-double1
(lambda (times image)
(if (= times 0)
image
(repeatedly-double1 (- times 1)
(stack image image)))))
(define repeatedly-double2
(lambda (times image)
(if (= times 0)
image
(let ((mostly-doubled
(repeatedly-double2 (- times 1)
image)))
(stack mostly-doubled mostly-doubled)))))