摘要:
递归写法: 迭代写法: 阅读全文
摘要:
(define (compose f g) (lambda (x) (f (g x)))) ((compose square inc) 6) ((compose inc inc) 6) 阅读全文
摘要:
(define (double f) (lambda (x) (f (f x)))) (define (inc x) (+ x 1)) (((double (double double)) inc) 5) ;amazing (((double (double (double double))) inc) 0) 阅读全文
摘要:
;2.2 (define (make-point x y) (cons x y)) (define (x-point p) (car p)) (define (y-point p) (cdr p)) (define (print-point p) (newline) (display "{") (display (x-point p)) (display ","... 阅读全文
摘要:
(define (make-rat n d) (let ((g (gcd n d))) (cons (/ n g) (/ d g)))) (define (numer x) (car x)) (define (denom x) (cdr x)) (define (print-rat x) (newline) (cond ((= (denom x) 1) (display ... 阅读全文