Add Exercise 2.21
This commit is contained in:
parent
aef78e5af1
commit
d7215f85ca
@ -129,3 +129,15 @@ and upper bound."
|
||||
(if (null l)
|
||||
()
|
||||
(append (reverse-user (cdr l)) (list (car l)))))
|
||||
|
||||
;; Exercise 2.21
|
||||
(defun square-list (items)
|
||||
(if (null items)
|
||||
nil
|
||||
(cons (* (car items) (car items)) (square-list (cdr items)))))
|
||||
|
||||
(defun square-list-map (items)
|
||||
(map 'list #'(lambda (x) (* x x)) items))
|
||||
|
||||
(defun square-list-mapcar (items)
|
||||
(mapcar #'(lambda (x) (* x x)) items))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user