sitelogo
tv_setsize/2

Sets the size of a term vector.

tv_setsize(+Vector, +Size)

tv_setsize/2 sets the size of the term vector Vector to Size. Size has to be a non negative integer. With tv_setsize/2 you may expand or shrink the size of a term vector. If you shrink its size all elements with an index greater than Size will be lost (even if you set the size back to the previous vector size). If you expand the vector then all elements with an index greater than the previous vector size will be set to 'null'.

Arguments

Vector                  object (term vector)
Size                    integer

Examples

    tv_create(V),
    tv_add(V, one),
    tv_add(V, two),
    tv_add(V, three),
    tv_list(V, L1),
    tv_setsize(V, 2),
    tv_list(V, L2),
    tv_setsize(V, 4),
    tv_list(V, L3)
->
    L1 = [one,two,three]
    L2 = [one,two]
    L3 = [one,two,null,null]

Standard

This predicate is not part of the ISO-Prolog Standard.

See also

tv_create/1, tv_add/2, tv_size/2, tv_setsize/2, tv_set/3, tv_get/3, tv_list/2.


Up read on...
scroll to top managed with ubiCMS