Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the list of pairs of integers used in the previous questions. In Prolog, such lists are denoted by using the following syntax: [ [

Consider the list of pairs of integers used in the previous questions. In Prolog, such lists are denoted by using the following syntax:
[[2,3],[4,-2],[3,3]][[2,3]]
[]
Write a Prolog predicate intPairList/1 which takes only 1 parameter and evaluates to YES only if this parameter is a list of pairs of integers. You can assume that the constants in the parameters will always be integers (you dont need to check that).
Some example queries are given below:
?- intPairList([[2,3],[4,-2],[3,3]]).
YES
?- intPairList([[2,3]]).
YES
?- intPairList([]).
YES
?- intPairList([1,2])
NO
?- intPairList([[1,2,3]]).
NO
?- intPairList([[2,3],[4,-2,1],[3,3]]).
NO
RULES:
You can use only one fact and only one rule.
You must use anonymous variables whenever possible.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions

Question

Which form of proof do you find most persuasive? Why?

Answered: 1 week ago