Computer Science, asked by gitangli1183, 3 months ago

Define a recursive lisp function which takes one argument as a list and return last element of list

Answers

Answered by Oreki
2

Code:

(defun last-list (list)

(if (endp list)

nil

(let ((result (last-list (rest list))))

(if (not (null result))

result

(if (listp (first list))

(first list)

nil)))))

Similar questions