Chapter 2, Building Abstractions with Data

Section - 2.2 - Hierarchical Data and the Closure Property

Exercise 2.21


1
2
3
4
5
6
7
8
9
10
11
12
13
14
#lang sicp

(define (square-list items)
  (if (null? items)
      nil
      (cons (square (car items)) (square-list (cdr items)))
  )
)  

(define (square x) (* x x))  

(define (square-list-by-map items)
   (map square items)
)