Error in scheme when using cadr
Can anyone clarify what this error means?
cadr: expects argument of type <cadrable value开发者_开发问答>; given (1)
cadr
means car
and cdr
. (i.e, return the car
of the cdr
of a list). Both the following expressions have the same effect:
> (car (cdr '(1 2 3 4)))
2
> (cadr '(1 2 3 4))
2
(cadr '(1))
will fail because (cdr '(1))
evaluates to null
.
精彩评论