rm-hull/wam

Exercise 2.8

Opened this issue · 2 comments

There is a typo, it should be: ?-p(f(X), h(Y, f(a)), Y). with a capital Y.

I think that would be indeed a leap (quite a big one). Not sure, does this work with the machine?
Query: ?-p(f(X), h(Y, f(a)), Y).

put-structure f|1, A1
set-variable X4
put-structure h|2, A2
set-variable X5
set-variable X6
put-value X5, A3
put-structure f|1, X6
set-variable X7
put-structure a|0, X7
call p|3

Fact: p(Z, h(Z, W), f(W)).

get-variable X4, A1
get-structure h|2, A2
unify-value X4
unify-variable X5
get-structure f|1, A3
unify-value X5
proceed

Maybe it is a breadth-first tree walk algorithm for the conversion of terms to instructions.

Why is it page 18? Isn't the exercise at page 23?

Ooh, good spot. I haven’t done much with this in the last few years, so I need to refamiliarize myself before responding definitively

Take your time. After working some more with the paper, the query instructions are created with a post order tree walk algorithm (this query is wrong). But fact instructions are OK.