Lecture 9 Notes

x 9 s 63

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: heme value, but we do not explicitly pass and return it, as the specification suggests. Instead, we keep the state in a single Scheme global variable, to which all the procedures of the implementation have / example, where we used a shared location access. This is much like instead of passing an explicit argument. By using a single Scheme global variable, we also use as little as possible of our understanding of Scheme effects.   ¢ £ ¥ ¡¥ We still have to choose how to model the store as a Scheme value. We choose the simplest possible model: we represent the store as a list of expressed values, and a reference is a number that denotes a position in the list. A new reference is allocated by appending a new value to the list; and updating the store is modelled by copying over as much of the list as necessary. This representation is extremely inefficient. Ordinary memory operations require approximately constant time to execute, but in our representation these operations require time proportional to the size of the store. No real implementation would ever do this, of course, but it suffices for our purposes. 10 11  @ ¡¦£  @ ¨#£ © ¦£  ¥  § ©¥(¥ ¥ ¥©¥¥ ¥  £& ¢ 6 & 6 ¥3 ¨¥ ¤ ¢ ) '¥  ¤ !7¥  ¦E7   ¥ © ¢   !77 ¥ § © ¢  ¦¦% $¨ § 6 8 ¥ 6¥3 ¨ ¥  § & )  & §  ¨ ¥ 6¥ ©© ¢   9  ¤ &    £  ¦£  ¤¥  § ¥ ¥ © ¢   7 ¥ ¦% ¢  © ¢   ¦ ¨ ¥ © ¢   79  ¤ &    £  § 8 ¥3 ¥ 6¥3 ¥  6¥   8  6 ¥    !¥ E £ BB §   9  ¥ &  £ £  1 © ¢   ¥ %¦£ ¥  § ¥ 6 3 ¥  F ¥ 2¦© ¢ 8 £ ¥ #! G¦ ¤ ¦%¡ & ¢  ¨¨ " F ¥ &  ¤      ¥ ¤  &    £  ¤ F¥ G© ¢   ¥¦%  ¢ ¥¦¨!  £ ¥ © ET¦% ( £  £  !£ ¢  ¥ ¤ &  !0¥  ¦E  3 &  © ¥3 & ) ©& ¥3  §  %1  § & )  & ¤ §...
View Full Document

This document was uploaded on 03/17/2014 for the course CSG 111 at Northeastern.

Ask a homework question - tutors are online