Specifically, how do you read this code? I\'m familiar with what CAR and CDR do,
ID: 3883856 • Letter: S
Question
Specifically, how do you read this code? I'm familiar with what CAR and CDR do, but I don't know how to read the conditional statement
Explanation / Answer
The basic syntax of COND is:
(cond
((predicate1) (then do something 1)) ;if this predicate is true,
;do something 1
((predicate2) (then do something 2)) ;if this predicate is true,
;do something2,
;each predicate and action
;following the
;first one is optional
(t (else do this)) ;else, if none of the
;predicates returns
;T, do this
)
here predicate1 is NULL L then NIL
and predicate2 is NULL (CDR L) then CAR L
and the else case is F (CDR L)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.