28.01.2015 Views

Hermes: A Tutorial and Reference Manual - Researcher - IBM

Hermes: A Tutorial and Reference Manual - Researcher - IBM

Hermes: A Tutorial and Reference Manual - Researcher - IBM

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

strings,arrays,lists,<strong>and</strong>relations. representinganelementtypestate.Itcancontainthekeywordordered.A 10811.6.TableOperations<br />

canbecompared. typestatetheelementtypestate.Tablescanbeusedtorepresentbags,sets, tabletypedenitioncanalsocontainasetofkeys.Eachkeyiswrittenasa restrictionsguaranteethattableelementscanbecompared,<strong>and</strong>thatkeys initialized,(2)theelementtypestatemustnotbefullyuninitialized.These listofformalvariables.Restrictions:(1)Thevariablesofakeymustbe Atabletypedenitioncontainsanelementtype<strong>and</strong>aformaltypestate<br />

order. ofallkeys.Twoelementsdierinakeyiftheydierinanyvariableofthat key. etcṪwoorderedtablesareequaliftheycontainequalelementsinthesame ments.Therstelementofthetableissaidtohaveposition0,thenext1, Twounorderedtablesareequaliftheirelementscanbeputinone-to-one Thevalueofanorderedtableisanordered(possiblyempty)setofele-<br />

Ifatablehaskeys,anytwoelementsofthetablewillhavedierentvalues<br />

someexamplesoftabletypedenitions. correspondence<strong>and</strong>thecorrespondingelementsareequal.Thefollowingare stringset:tableofstringfinitgkeys(*); string:orderedtableofcharfinitg; intbag:tableofintegerfinitg; person:record(<br />

inconventionallanguages:itisatotallyorderedbag.Typestringset multipleoccurrencesofthesameinteger.Typecharstringislikeastring );id:integer persontable:tableofpersonffullgkeys(name,address)(id); Typeintbagisabag|itcanholdanynumberofintegers,including name:string,<br />

hastheadditionalspecicationthatnotwostringsmaybeequal|thus address:string,<br />

elementscanhavethesamevalueofid.Thistypeactslikeatwo-way mappingbetweenidnumbers<strong>and</strong>name-addresspairs. Newsimple{statement elementscanhavethesamestringsforbothname<strong>and</strong>address,<strong>and</strong>notwo itbehaveslikeaset.Typepersontablehasthepropertythatnotwo ::=newvariable{name

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!