(Hint: You may use built-in predicate get0(C) for input and (Atom,...) in order to convert a list of character into a constant.)
2. Discuss where cuts could be placed in the following program for substitute. Consider whether a cut-fail rule would be useful, and whether explicit conditions can be omitted.
substitute(Old, New, OldTerm, NewTerm )
substitute(Old, New, Old, New).
substitute(Old, New, Term, Term) :-
substitute(Old, New, Term, Term1) :-
substitute(N, Old, New, Term, Term1) :-
substitute(0, Old, New, Term, Term1).
3. Write a prolog program that implements the mergesort of a list of integers.