Mercurial > repos > other > SevenLanguagesInSevenWeeks
comparison 3-Prolog/day1-food.pl @ 52:cbaa3546f3f8
Add extra thought on why you sometimes get "no" and sometimes "yes" after variable lists
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Tue, 26 Sep 2017 19:42:02 +0100 |
parents | 178b18b4f9ba |
children |
comparison
equal
deleted
inserted
replaced
51:178b18b4f9ba | 52:cbaa3546f3f8 |
---|---|
14 | 14 |
15 food_flavour(X, Y) :- food_type(X, Z), flavour(Y, Z). | 15 food_flavour(X, Y) :- food_type(X, Z), flavour(Y, Z). |
16 % Note: flavour(sweet, What) will return 'yes' and a closed set of answers because it is just all of the facts | 16 % Note: flavour(sweet, What) will return 'yes' and a closed set of answers because it is just all of the facts |
17 % but "food_flavour(What, meat)" will return answers and then say 'no', because it hasn't been given a flavour() | 17 % but "food_flavour(What, meat)" will return answers and then say 'no', because it hasn't been given a flavour() |
18 % fact for "ritz"/"cracker". | 18 % fact for "ritz"/"cracker". |
19 % This doesn't explain why "food(What, meat)" returns "no" after spam and sausage, though. | 19 % This doesn't explain why "food(What, meat)" returns "no" after spam and sausage, though. Maybe because there's |
20 % flavour(savoury, meat) so Prolog knows savoury is associated with meat but doesn't know whether it is in a food() | |
21 % fact without more processing? |