Visitor No.

Sunday 13 December 2015

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

7 - Define a Recursive LISP function which takes one argument as a list and returns reverse of the list.

      Implementation Code in LISP -  
    
       ( defun fun1(l)
      ( if (null l) l 
       (append (fun1 ( cdr l)) (list (car l)))))

     OUTPUT- 

       (fun1 '(1 2 3 4) )
       (4 3 2 1)

No comments:

Post a Comment