?- maxmin([3,1,5,2,7,3],Max,Min).
Max = 7
Min = 1
?- maxmin([2],Max,Min).
Max = 2
Min = 2
?- oddEven([3,1,5,2,7,3],L).
L = [odd,odd,odd,even,odd,odd].
?- reverseDrop([3,1,5,2,7,3],L).
L = [ 7, 5, 3 ].
?- reverseDrop(['world','a','hello'],L).
L = [ 'hello', 'world' ].
Complete the predicate below that is to add up all the numbers in a list but uses an alternating sign. Example:
?- addAlternate([5,6,1],S).
S = 0.
?- addAlternate([3,1,5,2,7,3],S).
S = 9.
addAlternate(L,S) :- __________________________.
addAlternate(___________________).
addAlternate([H|T],A,p,S) :- !,
AA is A + H,
addAlternate(T,AA,m,S).
addAlternate([H|T],A,m,S) :- !,
AA is A - H,
addAlternate(T,AA,p,S).