Week 5 Flashcards
(7 cards)
What is a Number in Prolog?
A value that is either an Integer or a Float
What is an Atom in Prolog?
A constant that does not have a numerical value
Begins with a lowercase letter or is quoted
eg.
buffallo
malcomX
“The X Files” - If you want spaces you must quote “”
What is a Variable in Prolog?
A term that is to be determined
Starts with an uppercase letter or underscore
eg.
X
Author
Person_A
What is a Compound Term in Prolog?
Consists of a functor followed by a sequence argument terms in brackets
eg.
dog(rover)
person(‘Swift’,6,9)
What are Lists in Prolog?
Made up of elements (possibly of different type) enclosed in square brackets and separated by commas
eg. [2,3,4,5,6,7]
How do you join lists in Prolog?
The cons (or “|”) notation allows one to represent a list as being constructed from some leading elements and a list
eg.
[1,2,3|[4,5]] -> makes [1,2,3,4,5]
What is Backtracking in Prolog?
If any goal fails, the Prolog system tries to find another way of satisfying the most recently satisfied previous goal
This is known as backtracking