Visitor No.

Sunday 13 December 2015

Recursive LISP function which takes one argument as a list and returns last element of the list.

5 - Define a Recursive LISP function which takes one argument as a list and returns last element of the list.

     Implementation Code in LISP - 

       (defun lastFirst(list) 
       (first (reverse list)))

    OUTPUT-

       (lastFirst '(1 2 3 4 5))
         5
           

1 comment: