WITHOUT USING LET
(defun cube-list (lst)
(cond ((null lst) nil)
(t ( cons (* (car lst) (car lst) (car lst)) (cube-list(cdr lst)) ) )
)
)
USING LET
(defun cube-list (lst)
(cond ((null lst) nil)
(t ( let ((a (car lst))) (cons (* a a a) (cube-list(cdr lst))) ) )
)
)
(defun cube-list (lst)
(cond ((null lst) nil)
(t ( cons (* (car lst) (car lst) (car lst)) (cube-list(cdr lst)) ) )
)
)
USING LET
(defun cube-list (lst)
(cond ((null lst) nil)
(t ( let ((a (car lst))) (cons (* a a a) (cube-list(cdr lst))) ) )
)
)
Comments
Post a Comment