sicp-ex-2.21



<< Previous exercise (2.20) | Index | Next exercise (2.22) >>


jz

  
 (define (square-list items) 
   (if (null? items) 
       items 
       (cons (square (car items)) (square-list (cdr items))))) 
  
 (square-list (list 1 2 3 4)) 
  
 (define (sq2 items) 
   (map (lambda (x) (square x)) items)) 
  
 (sq2 (list 1 2 3 4)) 
  

  
 (define (sq3 items) 
   (map square items)) 
  
 (sq3 (list 1 2 3 4))