It is best not read the answers until you've tried to answer the questions yourself.
[[1] | [2, 3]]
and [1 | [2, 3]] ?
Answer: In the first case, the first element of the list is
[1], the list containing just the number 1.
In the second case, the first element is 1.
If you don't get it, try the queries:
?- X = [[1] | [2, 3]]. ?- Y = [1 | [2, 3]].
?- likes(jane, Y) = likes(X, pizza).
Answer:
Y = pizza, X = jane.Remember that
= is a matching operator.
Answer:
% sum1toN(N, Sum) binds Sum to the sum of the numbers 1 to N sum1toN(1, 1). sum1toN(N, Sum) :- N > 1, Nminus1 is N - 1, sum1toN(Nminus1, Sum1toNminus1), Sum is N + Sum1toNminus1.
Answer: With specificity ordering, the clauses in the condition part
of the eligible rules are known to be subsets or supersets of each other -
in this case, the most specific eligible rule is chosen to fire - i.e.
the one with the most clauses in the condition.
With rule ordering, the rules are numbered, and the eligible rule
with the lowest number is chosen to fire.
In the BAGGER example, the rules
are ordered in such away that specificity ordering coincides with rule
ordering, but this need not be the case in general.
Answer: In a partitioned production systems, the rules are partitioned into subsets. At any given time, only one subset is "active". In each subset, there will be at least one rule that transfers control to some other subset, or at least one rule that stops the system.
Answer: An "isa" like connects an instance - a particular object - to its type - so it might connect a particular penguin named Percy to the "generic penguin". An "ako" link connects two types in a subset relation, so it might connect the penguin type to the bird type.
can_fly(bird, yes). ako(bird, vertebrate). have_feathers(bird, yes). ako(emu, bird). can_fly(emu, no). isa(ernie, emu). steals_potato_crisps(ernie, yes).
Answer:
Answer: Procedural attachment - i.e. demons.
Answer:
if_new, if_needed, if_added, if_removed, if_replaced, range, help.
Check lecture notes for when they are executed ("triggered").
Bill Wilson's contact info
UNSW's CRICOS Provider No. is 00098G