Week 5 Flashcards

(7 cards)

1
Q

What is a Number in Prolog?

A

A value that is either an Integer or a Float

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is an Atom in Prolog?

A

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 “”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a Variable in Prolog?

A

A term that is to be determined

Starts with an uppercase letter or underscore

eg.

X

Author

Person_A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a Compound Term in Prolog?

A

Consists of a functor followed by a sequence argument terms in brackets

eg.

dog(rover)

person(‘Swift’,6,9)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are Lists in Prolog?

A

Made up of elements (possibly of different type) enclosed in square brackets and separated by commas

eg. [2,3,4,5,6,7]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you join lists in Prolog?

A

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]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is Backtracking in Prolog?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly