| Did you know ... | Search Documentation: |
| Send methods |
skipped elements
are filled with @default.from and to
default to vector<-low_index
resp. vector<-high_index.
This is a common way to create a vector with a specific range.
@arg1 The current element @arg2 Index of this element
Its behaviour is undefined if the size of the vector is changed by code.
Using the from and to arguments, the range
as well as the order of visited elements can be reduced. Using only from,
the vector is enumerated starting at the given index.. Using only to,
the vector is enumerated from vector<-low_index
to the given index. Using both from and to,
the vector is enumerated in the given range. If to < from
the enumeration is executed backwards.
See also vector->for_some, vector<-find
and vector<-find_all.
@arg1 The current element @arg2 Index of this element
Its behaviour is undefined if the size of the vector is changed by code.
Using from and to, the range and order can
be defined. See
vector->for_all
for details.
Bugs: It would be useful to be able to create a vector with a specified low and high index. To create a vector [5...20] do:
new(V, vector), send(V, fill, @nil, 5, 20).
freed places
are filled with
@nil:
?- new(V, vector(gnu, gnats)), send(V, shift, 1), object(V, Term). Term = vector(@nil, gnu)
->sort. From
and To may be used to sort only part of the vector. From
defaults to vector<-low_index,
and To to
vector<-high_index.
If To <= From, vector->sort
succeeds without any side-effects.
->sort