Question: Complete the predicate below that is to add up all the numbers in a list but uses an alternating sign. using prolog. please help me
Complete the predicate below that is to add up all the numbers in a list but uses an alternating sign. using prolog.

please help me with this number.
?- addAlternate([5,6,1],s). ?- addAlternate([3,1,5,2,7,3],s) addAlternate(L,S)- addAlternate( addAlternate([HT],A,p,S):- !, AA is A H, addAlternate(T,AA,m, S) addAlternate([HT],A,m,S) !, AA is A - H, addAlternate (T,AA,p,S)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
