VDM-10 Language Manual
VDM-10 Language Manual
VDM-10 Language Manual
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Chapter 3. Data Type Definitions<br />
Operator Name<br />
Tail<br />
Semantics Description<br />
yields the subsequence of l where the first element is<br />
removed. l must be a non-empty sequence.<br />
Length yields the length of l.<br />
Elements yields the set containing all the elements of l.<br />
Indexes yields the set of indexes of l, i.e. the set<br />
{1,...,len l}.<br />
Concatenation<br />
Distributed concatenation<br />
applica-<br />
Sequence<br />
tion<br />
Sequence modification<br />
yields the concatenation of l1 and l2, i.e. the sequence<br />
consisting of the elements of l1 followed by<br />
those of l2, in order.<br />
yields the sequence where the elements (these are sequences<br />
themselves) of ll are concatenated: the first<br />
and the second, and then the third, etc.<br />
the elements of l whose indexes are in the domain of<br />
m are modified to the range value that the index maps<br />
into. dom m must be a subset of inds l<br />
yields the element of index from l. i must be in the<br />
indexes of l.<br />
Examples: Let l1 = [3,1,4,1,5,9,2], l2 = [2,7,1,8],<br />
l3 = [, , , ] then:<br />
len l1 ≡ 7<br />
hd (l1ˆl2) ≡ 3<br />
tl (l1ˆl2) ≡ [1,4,1,5,9,2,2,7,1,8]<br />
l3(len l3) ≡ <br />
"England"(2) ≡ ’n’<br />
reverse l1 ≡ [2,9,5,1,4,1,3]<br />
conc [l1,l2] = l1ˆl2 ≡ true<br />
conc [l1,l1,l2] = l1ˆl2 ≡ false<br />
elems l3 ≡ { ,<br />
,<br />
,}<br />
(elems l1) inter (elems l2) ≡ {1,2}<br />
inds l1 ≡ {1,2,3,4,5,6,7}<br />
(inds l1) inter (inds l2) ≡ {1,2,3,4}<br />
l3 ++ {2 |-> ,4 |-> } ≡ [ ,<br />
,<br />
,<br />
]<br />
17