Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exercise 2.8 #1

Open
ghost opened this issue Apr 9, 2021 · 2 comments
Open

Exercise 2.8 #1

ghost opened this issue Apr 9, 2021 · 2 comments

Comments

@ghost
Copy link

ghost commented Apr 9, 2021

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?

@rm-hull
Copy link
Owner

rm-hull commented Apr 12, 2021

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

@ghost
Copy link
Author

ghost commented Apr 12, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant