/** *************************************************************************************************************************** *this is only applicable using the database that Jamie has used during his lecture. in this case its lecture 17 [l17] database* *************************************************************************************************************************** **/ addplus(4,5,9). /** returns false **/ addplus(4,5,z). /** returns an instanciation of z=4+5 **/ /** due to a crash of jove the lecture was more observed rather than coded**/ sum(10,S). /** returns an instanciation of S=55, a sum of all numbers from 0 to the number input. it does so working down from 10 rather than up **/ sumofsquares(10,S). /** returns an instanciation of S=385, for a sum of all squares from 0 to the number input **/ /** * sum(0,0). * sum(N,S) :- N1 is N-1, sum(N1,S1),S is S1+N. **/ /** S1 is a subvariable for recursive call of the function. if N1 would be placed after the it would return "varialbes not fully instanciated" error **/ sumlist([1,2,3],S). /** returns an instanciation of S=6. the sum of all items in the list **/ smlist([1,2,3,10],S). /** returns an instanciation of S=16. **/