annotate 3-Prolog/day1-unification.pl @ 73:74976fddd25f
Ignore Erlang binary files and remove existing ones
author |
IBBoard <dev@ibboard.co.uk> |
date |
Sat, 03 Feb 2018 19:52:45 +0000 |
parents |
91d02b3d74f8 |
children |
|
rev |
line source |
54
|
1 % "=" isn't assignment in Prolog, it is "unification" - finding something where
|
|
2 % both structures are identical
|
|
3 cat(lion).
|
|
4 cat(tiger).
|
|
5
|
|
6 % This rule makes sure that X, Y and Z match a lion, a tiger and a bear (oh my!)
|
|
7 dorothy(X, Y, Z) :- X = lion, Y = tiger, Z = bear.
|
|
8
|
|
9 % This rule checks whether both things are cats, if so then they are "twin_cats"
|
|
10 twin_cats(X, Y) :- cat(X), cat(Y). |