* Describe briefly the working principles of LISP.
* Describe briefly the working principles of PROLOG.
* Write both a LISP program and PROLOG program for the following problems
a) find the length of a list
b) find the average of a list of numbers
c) combine two sorted lists into a sorted list
d) reverse a list.
This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.
size([H|T],N) :- size(T,N1), N is N1+1.
reverse(L, R) :-
reverse2(L, , R).
reverse2(, R, R).
reverse2([H|T], O, R) :-
reverse2(T, [H|O], R).
sum([X|L],N):-sum(L,N1),N is X+N1.
average(L,X):-sum(L,S), size(L,N), X is S/N.
merge( , RS, RS ).
merge( LS, , LS ).
merge( [L|LS], [R|RS], [L|T] ) :- L =< R, merge( LS, [R|RS], T).
merge( [L|LS], [R|RS], [R|T] ) :- L > R, merge( [L|LS], RS, T)....
This is only a preview of the solution. Please use the purchase button to see the entire solution