cons
,
car
, cdr
(car (cons 1 2))
evaluate to?cdr (cons 1 2))
evaluate to?(cdadr (cons 1 (cons (cons 2 3) 4)))
evaluate
to?list
, quoting,
caar
/cadr
/etc.(cdr (list 1 2))
evalute to?(cons 1 (cons 2 (cons 3 '())))
Suppose we (define s (list 1 2 3 4))
.
(cadr s)
evaluate to?(cddr s)
evaluate to?sum
that returns the sum of the
elements in a list; assume the list contains only numbers.avg
that returns the average of the
elements in a list; you may use any function(s) we’ve written so far,
even if you don’t currently have a working implementation.