USING IF
(defun sum(list)
(if (null list) 0 (+ (car list) (sum(cdr list))) )
)
USING COND
(defun sum(list)
(cond ( (null list) 0 )
( (+ (car list) (sum(cdr list))) )
)
)
USING COND AND ELSE
(defun sum(list)
(cond ( (null list) 0 )
(else (+ (car list) (sum(cdr list))) )
)
)
(defun sum(list)
(if (null list) 0 (+ (car list) (sum(cdr list))) )
)
USING COND
(defun sum(list)
(cond ( (null list) 0 )
( (+ (car list) (sum(cdr list))) )
)
)
USING COND AND ELSE
(defun sum(list)
(cond ( (null list) 0 )
(else (+ (car list) (sum(cdr list))) )
)
)
Comments
Post a Comment