Programs in lisp with output
Define a Recursive LISP function which appends two lists together.
SOFTWARE
USED: LispWorks
6.1
THEORY:-
Assuming this is
about Common Lisp, there is a function which
appends two lists. If
you use this function which applies a given function two list as
parameters, returns first list with the element of the second list appended.
SOURCE
CODE ( IF INCLUDED )
(defun list-append (L1 L2)
"Append L1 by L2."
(if (null L1)
L2
(cons (first L1) (list-append (rest L1)
L2))))
LIST-APPEND
> (list-append
'(a b c) '( c d e))
(A B C C D E)
> (list-append '(4
2)'(2 3))
(4 2 2 3)
RESULT:-
CONCLUSION:-
We learned about writing the recursive
LISP function which appends two lists together