I don't quite understand the manual text for call/1

https://www.swi-prolog.org/pldoc/man?predicate=call/1

shows

Invoke Goal as a goal. Note that clauses may have variables as subclauses, which is identical to call/1.

The same appears on help(call) from swipl.

Does that mean that if these variables are bound, their values are invoked using call/1? Or is it a typo of some kind?

Did you scroll down on the documentation page for call/1?

It references a Q&A on StackOverflow

1 Like

Calling an unbound variable is an error, then I think the doc attempts to clarify that instead something like this can be done

?- X=member(A,[1,2,3]),Y=writeln(A),call((X,Y)).
1
X = member(1, [1, 2, 3]),
A = 1,
Y = writeln(1) ;
2
X = member(2, [1, 2, 3]),
A = 2,
Y = writeln(2) ;
3
X = member(3, [1, 2, 3]),
A = 3,
Y = writeln(3).

I guess there is a typo. It should read, i.e. ISO core standard body conversion:

clauses may have variables as subgoals, which are then wrapped in call/1.

Like here:

SWI-Prolog (threaded, 64 bits, version 8.3.0)

?- [user].
and(X,Y) :- X, Y.
^D

?- listing(and/2).
and(A, B) :-
    call(A),
    call(B).
3 Likes

Shame on me, no, didn’t read further down. Thanks for the hint, I will be more attentive next time.

Thanks for the answers! So I basically did get it right, was just a bit confused by the text.

Actually there would be more to say about call/1. For example that it is
not cut (!) transparent. You can take this example without call/1:

?- repeat, !.
true.

And then with call/1:

?- repeat, call(!).
true ;
true ;
true ;
Etc..
2 Likes