Mercurial > repos > other > SevenLanguagesInSevenWeeks
view 3-Prolog/day1-unification.pl @ 72:e05701354b6e
Add notes from Day 2
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Fri, 02 Feb 2018 20:59:06 +0000 |
parents | 91d02b3d74f8 |
children |
line wrap: on
line source
% "=" isn't assignment in Prolog, it is "unification" - finding something where % both structures are identical cat(lion). cat(tiger). % This rule makes sure that X, Y and Z match a lion, a tiger and a bear (oh my!) dorothy(X, Y, Z) :- X = lion, Y = tiger, Z = bear. % This rule checks whether both things are cats, if so then they are "twin_cats" twin_cats(X, Y) :- cat(X), cat(Y).