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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ationtable[expr].Wehaveencounteredthisabbreviationintheprogram positioninthetableisexpr."Thisformofselectorworksexactlylikearray indexing.Itissocommonthat<strong>Hermes</strong>allowsyoutousetheabbrevi-<br />

where(positionofelement=expr)means\selecttheelementwhose BoundedBuffer.ThestatementremovecmdfromLine[0]isashorth<strong>and</strong> 422.6.TokenizerProcedure<br />

\removetherstcharacterfromLine<strong>and</strong>storeitincmd." theelementbeingtestedbytheselector.Forexample,elementintable<br />

aspartofanotheroperator:e.g.remove,every,extract,position: forremovecmdfromCinLinewhere(positionofC=0),<strong>and</strong>itmeans Aselectorcanappeareitherbyitselfasanexpression,oritcanappear Aselectorallbyitselfinanexpressionreturnsacopyoftheselected thentheearliestoneischosenifthetableisordered,<strong>and</strong>anarbitrary oneischosenifthetableisunordered.ANotFoundexceptionisraised ifthereisnoselectedelement.Example:Line[0]evaluatestotherst characterofLine,ifLineisnon-empty,otherwiseitraisesaNotFound thenamethe-element.Ifthereismorethanoneselectedelement, exception.ItcanalsobewrittenCinLinewhere(positionofC =0). element.Youcanlookthisoperationupinthereferencemanualunder<br />

Theeveryofoperationgeneratesanewtableconsistingofevery Theremovestatementremovesasingleelement.Ifnoelementis selected,therstselectedelementischosenifthetableisordered, selected,aNotFoundexceptionisraised.Ifmorethanoneelementis otherwiseanarbitrarychoiceismade.<br />

Theextractstatementissimilartoeveryof,exceptthatitremoves wherethisoperationwasusedtoselectthosecharactersbefore<strong>and</strong> computesubsetsorsubstrings.(ReferbacktotheprogramCompound, elementswillhavethesamerelativeorder.Thisoperationisusedto selectedelement.Iftheoriginaltablewasordered,thetableofselected afterthe'/'.<br />

ble,<strong>and</strong>thepositionofoperatordiscussedabove,whichisappliedwithin Notethedierencebetweenpositionofselector,whichsearchesata-<br />

Thepositionofoperationwithaselector(e.g.positionofCin aNotFoundexceptionisgenerated. Linewhere(C=':'))returnsthepositionoftherstselectedelementwithintheorderedtable.Ifnoelementinthetableisselected,<br />

theelements. theselectedelementsfromitssourceoper<strong>and</strong>,ratherthancopying<br />

=':').ThisexpressionsearchesfortherstcoloninLineafterposition P,<strong>and</strong>returnsthepositionofthatcolon. aselectorpredicate.Thefollowingexpressionusesbothkindsofposition ofoperators:positionofCinLinewhere(positionofC>P<strong>and</strong>C

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

Saved successfully!

Ooh no, something went wrong!