IF Computer > MINERVA > Manual > Reference > Predicates > Term vector > tv_setsize/2

tv_setsize/2

MINERVA
ifcomputer logo
f
Expert Services on the Web

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.

document: http://www.ifcomputer.co.jp/MINERVA/Manual/Reference/Predicates/termvector/tv_setsize/print_en.html
published 2008/10/6 update 2002/3/19 (c) 1996-2006 IF Computer Japan
IF Computer 5-28-2 Sendagi, Bunkyo-ku Tel +81-3-5814-3352 start (AT) ifcomputer.com
Customer Support Tokyo 113-0022 Japan   http://www.ifcomputer.com
Back> managed with ubiCMS