Question: Write a Prolog rule manhattan / 3 where the first two arguments are pairs representing points on the Cartesian coordinate system. Your rule should succeed

Write a Prolog rule manhattan/3 where the first two arguments are pairs representing points on the Cartesian coordinate system. Your rule should succeed when the third argument is the Manhattan distance between the two points. For example:
?- manhattan([-1|4],[1|8],6).
true.
?- manhattan([-4|-3],[6|3],X).
X =16.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!