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

Procedure not found #2655

Open
flexoron opened this issue Nov 2, 2024 · 7 comments
Open

Procedure not found #2655

flexoron opened this issue Nov 2, 2024 · 7 comments

Comments

@flexoron
Copy link

flexoron commented Nov 2, 2024

$ scryer-prolog -f
?- use_module(library(freeze)).
   true.
?- [user].
b(_,_,_).

?- freeze(X,Y=Z),freeze(Y,Y),bagof(Y=Y,X=Y,[Z=Z]),X=b(_,_,_).
   error(existence_error(procedure,b/3),b/3). % unexpected because:
?- b(1,2,3).
   true.
?- 
@flexoron
Copy link
Author

flexoron commented Nov 2, 2024

Shorter

?- freeze(X,Y=X),freeze(Y,Y),X=b(_,_,_).
   error(existence_error(procedure,b/3),b/3).

Shortest

?- freeze(X,X),X=b(_,_,_).
   error(existence_error(procedure,b/3),b/3).

@UWN
Copy link

UWN commented Nov 2, 2024

Shortester:

?- freeze(X,X).
   freeze:freeze(X,X).

Thus there is no clue, that X should be interpreted in module user and not in module freeze as in SICStus:

| ?- freeze(X,X).
prolog:freeze(X,user:X) ? 
yes

@triska
Copy link
Contributor

triska commented Nov 2, 2024

Related: #2625.

@flexoron
Copy link
Author

flexoron commented Nov 2, 2024

Why is this:

$ scryer-prolog -f
?- use_module(library(lists)).
   true.
?- use_module(library(freeze)).
   true.

?- [user].
:- module(b, [b/0]).
b:b.

?- freeze(X,X:X),X=b.
   X = b.
?- member(X,[b]).
   X = b.
?- freeze(X,X:X),member(X,[b]).
   error(type_error(callable,b:b),call/1). % what does it mean: callable?
?- call(b:b).
   true.
?- 

@UWN
Copy link

UWN commented Nov 3, 2024

?- [X]=[b], b:X.
   X = b. % as expected
?- [X]=[b], X:b.
   error(type_error(callable,b:b),call/1), unexpected.

@UWN
Copy link

UWN commented Nov 3, 2024

Related to partial strings, because

?- B=b,freeze(X,X:X),member(X,[B]).
   B = b, X = b. % as expected
?- freeze(X,X:X),[X]=[b].
   error(type_error(callable,b:b),call/1), unexpected.
?- [X]=[b], X:X.
   error(type_error(callable,b:b),call/1), unexpected.
?- asserta(t).
   true.
?- [X]=[t],X.
   X = t. % here, it seems to work

@flexoron
Copy link
Author

flexoron commented Nov 28, 2024

$ rustc --version
rustc 1.83.0 (90b35a623 2024-11-26)
$ scryer-prolog -v
v0.9.4-210-gff034326

$ scryer-prolog -f
?- use_module(library(lists)).
?- use_module(library(lambda)).
?- [user]. f(x,y). end_of_file.

?- f(X,Y).
   X = x, Y = y.
?- call(f,A1,A2).
   A1 = x, A2 = y.
?- call(call(f, A1),A2).
   A1 = x, A2 = y.
?- call(f(A1),A2).
   A1 = x, A2 = y.

% lib/lambda.pl examples:

?- call(\X^f(X),A1,A2).
   error(existence_error(procedure,f/2),f/2). % unexpected
?- call(\X^Y^f(X,Y), A1,A2).
   error(existence_error(procedure,f/2),f/2). %    "
?- call(\X^(X+\Y^f(X,Y)), A1,A2).
   error(existence_error(procedure,f/2),f/2). %    "
?- 
The 'lib/lambda.pl' examples have been fixed with v0.9.4-215-gdba9c9a0
?- call(\X^(X+\Y^f(X,Y)), A1,A2).
   A1 = x, A2 = y.

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

3 participants