Rahul Kumar Saurabh

A Recursive LISP function which takes one argument as a list and return last element of The list.

  
           Programs in lisp with output


SOFTWARE USED:  LispWorks 6.1

THEORY:-
Assuming this is about Common Lisp, there is a function which returns a list containing the last item of a list.  If you use this function which applies a given function to each element of a list and returns the concatenated results, you'll get what you want.


SOURCE CODE ( IF INCLUDED )

(defun last_element(any_xyz_list)
(first(reverse any_xyz_list)))

LAST_ELEMENT

(last_element '(p q r s))

s


RESULT:-


CONCLUSION:-

We learned about writing the function to evaluate takes one argument as a list and return last element of The list.