(define last-digit ; last-digit returns the smallest (rightmost) digit of a ; non-negative integer n. (lambda (n) (remainder n 10))) (define first-digits ; first-digits returns a number which consists of all but the ; rightmost digit of n, which must be a non-negative integer. ; If n is less than 10, then first-digits returns 0. (lambda (n) (quotient n 10))) (define digit? ; digit? returns #t if n is a single-digit integer, #f otherwise. ; n must necessarily be a non-negative integer. (lambda (n) (and (<= 0 n) (<= n 9)))) (define splice-together (lambda (n d) ; splice-together returns the integer formed by having n as the leftmost ; digits and d as the rightmost digit. Thus (splice-together 12 4) -> 124 ; n and d must both be non-negative integers, with 0 <= d <= 9 (+ (* 10 n) d)))