Created
December 12, 2012 07:04
-
-
Save yao2030/4265708 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (map p sequence) | |
(accumulate (lambda (x y) (cons (p x) y)) '() sequence)) | |
(define (append seq1 seq2) | |
(accumulate cons seq2 seq1)) | |
;; it took me about half an hour to figure length out. | |
(define (length sequence) | |
(accumulate (lambda (x y) (+ 1 y)) 0 sequence)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
SICP 2.33