<<<<<<<<<<<<<<<<<

s_vector(lymb) LYMB s_vector(lymb)

NAME

s_vector

SUPERCLASS

object

DESCRIPTION

S_vector (stands for string_vector) is a class for holding and manipulating vectors of strings in LYMB.

INSTANCE VARIABLES

dimension is the number of elements, or components, in an s_vector.

from is the starting index in an s_vector used for assignment and other string operations.

to is the ending index in an s_vector used for assignment and other string operations.

components are components of an s_vector.

MESSAGES

dimension= argument Set the dimension of the s_vector. If not set explicitly, it will be set implicitly by the number of arguments on the stack. If the dimension is reduced, data will be lost. If it is increased, new indexes are initialized to NULL.

dimension+ argument Extends the dimension of the s_vector by argument. The new indexes are initialized to NULL.

dimension? Return the dimension of an s_vector.

end_of_message Reset "from" and "to" of the instance, i.e., set from=1 and to=dimension, synonym to (;).

= arguments Set the values of components. Only the first (to - from + 1) number of arguments are used for assignment, others are discarded. If the number of arguments is less than (to - from + 1), they are reused in a circular fashion. The same applies to messages "+", "components=".

+ arguments Concatenate arguments to components.

? Return components of an instance, synonym to "components?".

components= arguments Set the values of components. Only the first (to - from + 1) number of arguments are used for assignment, others are discarded. If the number of arguments is less than (to - from + 1), they are reused in a circular fashion. The same applies to messages "+", "=".

components? Return components of an instance.

@ argument Set "from" and "to" to the argument, valid until the next "end_of_message".

from: argument Set "from" index.

from? Return "from" index.

to: argument Set "to" index.

to? Return "to" index.

length? Return the sum of string lengths of components.

max? Return maximum string length of the components.

min? Return minimum string length of the components.

swap! Reverse the order of elements restricted by "from" and "to".

insert: arguments Insert the arguments after the current "to" index. "To" references the last argument inserted after the message completes.

EXAMPLE

s_vector new: v1 dimension=10; -- print only four components v1 from:4 to: 7 = (a1,a2,a3,a4) print:components; v1 swap! print: components; -- will print all 10 components

SEE ALSO

scalar, string, vector


Please send comments and suggestions to
consult@rpi.edu