I’m going through the list of “mode indicators” again:
And created a little cheatsheet:
… and have a few question, which should be easy to answer (cough):
Q1
Currently the text (which I remember to have partially written myself, so any errors extant are mine) says: “partial term (a term which may or may not be ground)”.
Is this true? Are all of _
, [a|X]
and [a,b]
considered partial terms?
Q2
I never got that I am not supposed to pass an unbound variable at parameter positions marked with a +
(that’s so, right?)
But I can pass open lists, still?
For example, for foldl(:Goal, +List, +V0, -V)
, an unbound variable at List
position is a not supported (although it does work)
?-
foldl([E,FL,x]>>true,X,start,Final).
X = [],
Final = start ;
X = [_6450],
Final = x ;
X = [_6450, _11086],
Final = x
but an open list is still ok? It is a special kind of nonground term (and so is an open tree or open graph) and the empty open list is just an unbound variable and indistinguishable from any other domain. So maybe +
also means that open lists are disallowed, too, to keep the domains apart?
?-
foldl([E,FL,x]>>true,[a,b|X],start,Final).
X = [],
Final = x ;
X = [_8596],
Final = x ;
X = [_8596, _9992],
Final = x ;
X = [_8596, _9992, _11388],
Final = x
Here is another thought:
foldl(:Goal, +List, +V0, -V)
… should not have any opinion on the mode of V0
and V
because the mode of these depends on Goal
. They could be anything (this is where the type expression in Haskell gets complex I imagine?)
Q3
Somewhat related, the mode indicators for is_list/2
is
is_list(+Term)
.
I do think this should be is_list(@Term)
?