summaryrefslogblamecommitdiffstats
path: root/net/ricketyspace/sicp/two/twentyone.scm
blob: 8ad559e98ccf1b3129ad12b35b8cab910f2a17fc (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14













                                                    
;;;; License: CC0-1.0

(define-module (net ricketyspace sicp two twentyone)
  #:export (square-list-v1
            square-list-v2))

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

(define (square-list-v2 items)
  (map (lambda (x) (* x x)) items))