Last active
October 31, 2017 20:58
-
-
Save piyushmaurya23/71a4e66202158827f552 to your computer and use it in GitHub Desktop.
7. Define a Recursive LISP function which takes one argument as a list and returns reverse of the list. (do not use reverse predicate)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun list_append(l1 l2) | |
(if (null l1) | |
l2 | |
(cons (first l1)(list_append (rest l1) l2)))) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun list_reverse(l) | |
(if (null l) | |
nil | |
(list_append (list_reverse (rest l)) | |
(list (first l))))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment