Hi,
So I'm trying to finish up a project for a class. It's a "dating database". It includes 5 males, and 5 females. I have to match them up using the following rules:
(a) Only opposite sex can be matched
(b) Male candidate should have a higher age than Female candidate
(c) Male candidate should...
So this is my 2nd week learning prolog.
I wrote a function to calculate the sum of a list of numbers.
sum([], 0).
sum([Head |Tail], TotalSum) :-
sum(Tail, Sum1),
TotalSum is Head + Sum1.
So:
input: ?- (sum([4,3,-5],X))
output: X=2
However, the goal is get the absolute value of the sum of the...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.