26.09.2013 Views

Transformation of Applicative Specifications into Imperative ...

Transformation of Applicative Specifications into Imperative ...

Transformation of Applicative Specifications into Imperative ...

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.

APPENDIX C. FORMAL SPECIFICATIONS OF TRANSFORMATIONS<br />

Arguments:<br />

=======<br />

id: the list id<br />

ids: the ids already evaluated<br />

Results:<br />

=====<br />

Id_list: the resulting list <strong>of</strong> ids<br />

∗/<br />

getIdList : Id × Id-set × TYPINGS → Id ∗<br />

getIdList(id, ids, typings) ≡<br />

getIdListIdList(typings(id), ids ∪ {id}, typings),<br />

/∗Gets the ids which is part <strong>of</strong> the types <strong>of</strong> an<br />

id list.∗/<br />

/∗<br />

Arguments:<br />

=======<br />

idl: the id list<br />

ids: the ids already evaluated<br />

Results:<br />

=====<br />

Id_list: the resulting list <strong>of</strong> ids<br />

∗/<br />

getIdListIdList :<br />

Id ∗ × Id-set × TYPINGS → Id ∗<br />

getIdListIdList(idl, ids, typings) ≡<br />

if idl = 〈〉 then 〈〉<br />

else<br />

if hd idl ∈ ids<br />

then<br />

〈hd idl〉 getIdList(hd idl, ids, typings) <br />

getIdListIdList(<br />

tl idl, ids ∪ {hd idl}, typings)<br />

else<br />

removeDupletsId(<br />

〈hd idl〉 <br />

getIdListIdList(tl idl, ids, typings))<br />

end<br />

end,<br />

/∗**** TYPINGS end ****∗/<br />

/∗**** FUNC ****∗/<br />

288

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

Saved successfully!

Ooh no, something went wrong!