Last active
October 29, 2019 22:06
-
-
Save chelseatroy/e419afefdc4fd168f2972e9a5444f153 to your computer and use it in GitHub Desktop.
Mapping
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
; 2.21 | |
(define (square-list1 items) | |
(if (null? items) | |
null | |
(cons (* (car items) (car items)) (square-list1 (cdr items))) | |
) | |
) | |
(define (square-list2 items) | |
(map (lambda (x) (* x x)) items) | |
) | |
(square-list1 (list 1 2 3 4)) | |
(square-list2 (list 1 2 3 4)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment