projog

3.57. recorda(X,Y,Z) / recordz(X,Y,Z) - associates a term with a key.

recorda(X,Y,Z) associates Y with X. The unique reference for this association will be unified with Z. Y is added to the start of the list of terms already associated with X.

recordz(X,Y,Z) associates Y with X. The unique reference for this association will be unified with Z. Y is added to the end of the list of terms already associated with X.

Examples

Example of recorda/3.

?- recorda(a,q,X).
X = 0

yes

Note: recorda/2 is equivalent to calling recorda/3 with the third argument as an anonymous variable.

?- recorda(a,w).

yes

?- recorded(X,Y,Z).
X = a
Y = w
Z = 1

yes;
X = a
Y = q
Z = 0

yes

Note: recorded/2 is equivalent to calling recorded/3 with the third argument as an anonymous variable.

?- recorded(a,Y).
Y = w

yes;
Y = q

yes

Example of recordz/3.

?- recordz(b,q,X).
X = 2

yes

Note: recordz/2 is equivalent to calling recordz/3 with the third argument as an anonymous variable.

?- recordz(b,w).

yes

?- recorded(b,Y).
Y = q

yes;
Y = w

yes