I am studying for an exam right now but I am not sure if I understood the list
procedure in Scheme. I know that it can be used for creating list variables like (define x (list 'a 'b 'c))
. However I saw another usage of it in procedure creation:
1 ]=> (define foo3
(lambda (b lst)
(if b
(car lst)
(cadr lst)
)
)
)
;Value: foo3
1 ]=> (foo3 #f ’(a b))
;Value: b
1 ]=> ((foo3 #t (list cdr car)) ’(a b c))
;Value: (b c)
What does the (list cdr car) mean? (I know what cdr
and car
means in terms of referencing first and rest of the list)