Collects all elements of a term vector in a list.
tv_list/2 collects all elements (from 1st to last index) of the term vector Vector in a list and unifies the resulting list with List.
Vector object (term vector) Term term
tv_create(V),
( for(1,I,4),
SquareI is I*I,
tv_add(V, I*I = SquareI),
fail
; tv_list(V, Squares)
)
->
Squares = [1 * 1 = 1,2 * 2 = 4,3 * 3 = 9,4 * 4 = 16]
This predicate is not part of the ISO-Prolog Standard.