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

asserta/1 does not define new public predicate #309

Closed
UWN opened this issue Jan 5, 2024 · 2 comments
Closed

asserta/1 does not define new public predicate #309

UWN opened this issue Jan 5, 2024 · 2 comments

Comments

@UWN
Copy link

UWN commented Jan 5, 2024

?- asserta(a(1,2)).     
true.
?- clause(a(X,Y),B).
2024/01/05 21:20:04 error(permission_error(access,private_procedure,a/2),clause/2), unexpected.
   X=1,Y=2,B=true. % expected, but not found
@ichiban
Copy link
Owner

ichiban commented Jan 13, 2024

Thank you for reporting this! I'll fix it later.

Note to self:

8.9.1.4 says asserta((foo(X) :- X, call(X))). has the same effect as:

:- dynamic(foo/1).
foo(X) :- call(X), call(X).

7.5.3 says "a dynamic procedure shall be public."

@ichiban
Copy link
Owner

ichiban commented Feb 21, 2024

fixed in v1.2.0.

$ go install github.com/ichiban/prolog/cmd/1pl@latest
go: downloading github.com/ichiban/prolog v1.2.0
$ $(go env GOPATH)/bin/1pl
Top level for ichiban/prolog v1.2.0
This is for testing purposes only!
See https://github.com/ichiban/prolog for more details.
Type Ctrl-C or 'halt.' to exit.
?- asserta(a(1,2)).
true.
?- clause(a(X,Y),B).
B = true,
X = 1,
Y = 2.
?- 

@UWN UWN closed this as completed Feb 21, 2024
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

2 participants