Water 5-Type and Object System-Type SystemContract| Parameter key | Default value | Type | | min_length | 0 | integer | | max_length | null | | ui | opt | | Parameter kind | Default value | Type | | Other unkeyed arguments | opt | | Water Contract<class type.vector_of
min_length=0
max_length=null
ui =opt
_other_unkeyed=opt=wob=ekind.code="_add_to_environment"
/> | |
An object is of vector_of if it is of length between min_length and
max_length inclusive and each vector_key of the object holds
a type that matches the types given in the _vector_fields arguments.
If the object has a length longer than the number of _vector_fields args supplied,
then the last _vector_fields arg is used as the type to test the remaining
elements in the vector.
If no _vector_fields args are passed when calling vector_of, it is the same
as if one _vector_fields arg of thing was supplied, i.e. all elements will pass.
vector_of is quite flexible as it can be used to check that
the length of a vector is at least a certain amount but
no more than another amount as well as the type
of every element in the vector, each of which may be different or
all may be the same.
If max_length is null, that means that the maximum length of the vector is unlimited.
Examples: All of the following expressions return true.
<vector_of number/>.<is_type_for <vector 3 7/>/>
 | true |
<vector_of number/>.<is_type_for <vector 3 "asd"/>/>.<not/>
 | true |
<vector_of integer number.double/>.<is_type_for <vector 3 7.5/>/>
 | true |
<vector_of integer number.double/>.<is_type_for <vector 3 7.5 3.4/>/>
 | true |
<vector_of integer number.double/>.<is_type_for <vector 3 7.5 9/>/>.<not/>
 | true |
<vector_of integer number.double max_length=2/>.
<is_type_for <vector 3 7.5 3.4/>/>.<not/> | true |
<vector_of integer min_length=3/>.
<is_type_for <vector 88 89/> />.<not/> | true |
<vector_of min_length=2 max_length=4/>.
<is_type_for <vector 111 222/>/> | true |
<vector_of min_length=2 max_length=4/>.
<is_type_for <vector 111/>/>.<not/> | true |
© Copyright 2007 Clear Methods, Inc.