VDM-10 Language Manual
VDM-10 Language Manual
VDM-10 Language Manual
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>VDM</strong>-<strong>10</strong> <strong>Language</strong> <strong>Manual</strong><br />
element of the sequence. If the upper bound n2 is larger than the length of the sequence (the<br />
largest index which can be used for a non-empty sequence) the subsequence expression will<br />
end at the last element of the sequence.<br />
Examples: Given that GroupA is equal to the sequence<br />
✞<br />
✡✝<br />
[ mk_Score(,2,0,1,6),<br />
mk_Score(,1,2,0,5),<br />
mk_Score(,1,1,1,4),<br />
mk_Score(,0,1,2,1) ]<br />
✆<br />
then:<br />
[GroupA(i).team<br />
| i in set inds GroupA<br />
& GroupA(i).won 0]<br />
[GroupA(i)<br />
| i in set inds GroupA<br />
& GroupA(i).won = 0]<br />
≡<br />
≡<br />
[,<br />
,<br />
]<br />
[mk Score(,0,1,2,1)]<br />
GroupA(1,...,2) ≡ [mk Score(,2,0,1,6),<br />
mk Score(,1,2,0,5)]<br />
[GroupA(i)<br />
| i in set inds GroupA<br />
& GroupA(i).points = 9]<br />
≡ []<br />
6.9 Map Expressions<br />
Syntax: expression = . . .<br />
| map enumeration<br />
| map comprehension<br />
| . . . ;<br />
map enumeration = ‘{’, maplet, { ‘,’, maplet }, ‘}’<br />
| ‘{’, ‘|->’, ‘}’ ;<br />
maplet = expression, ‘|->’, expression ;<br />
map comprehension = ‘{’, maplet, ‘|’, bind list,<br />
[ ‘&’, expression ], ‘}’ ;<br />
Semantics: A map enumeration has the form:<br />
✞<br />
{d1 |-> r1, d2 |-> r2, ..., dn |-> rn}<br />
✡✝<br />
✆<br />
54