Lecture 11 Notes

Refer to this as the syntactic or grammatical

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: ¢ % [Easy puzzle: what would look like for this representation?] 9 2.3.3 Procedural Representation The environment interface has an important property: it has only one observer, . This allows us to represent an environment as a Scheme procedure that takes a symbol and returns its associated value. ¥ ¦¥ ¥ ¦¥ '  ¨¦  ¦ ¨¦  ¥ ¦¥ '  ¦ ¥     ¦   #  ¥ ¦¥ % ' to return procedures that, when did in the preceding section.  ¡ § ¦¡  ¢ ¨ ¡ ¦# ©  '¢ ¦ ¢  ' # ¥ ¦¥ ¦¦¦ ¥¥¥¦ # © © ¡ '  ©§   ¦ and To do this, define applied, do the same thing that  ¥ ¨ ¥  £ §   ¦ ¦¥ ¦ ¤ ¥ ©  ¥ ¥ ¦¥  ¨¦ ¥ ¦¥ ¡ ¥ ¥ #'©  ¥ ¤ ¥ ©  ¦# © ' ¦¥¦§¦¥¦¥¦ # © ' '  ¦  # ' © ¢ ¥  ¦¢ ¥ ©  ¦  ¥ ¦¥  ¦ ¨   '  ¥ ¤ ¥ © ¤ ¥ ¡  ¦# © '¢ ¤ ¥ ©   ¦ ¥  § ¢ £#$  ¢  £ $  ¢ #  ¥    ¢  ¢ ©  ¢ ¢  £#$  ¢ # ¢ £ $ ¢  ¥    ¢ % ¦¦ ¥¥¦ # © ¦¥  ¥ ' ¢ ¦ # ' © ¦¥  ¢  £ $  ¢ ¥ #  ¨¦  ¥    ¢ ¥ ¦¥ ¥ ¦¥  ¦ '  ' # If the empty environment, created by invoking , is passed any symbol whatsoever, it indicates with an error message that the given symbol is not in its domain. The procedure returns a new procedure that represents the extended environment. This procedure, when passed a symbol , checks to see if the symbol it is looking for is the same as the one bound in the environment. If it is, then the saved value is returned. Otherwise, the symbol is looked up in the saved environment.  ¦ ¥ ¦¥ #'©  ¦ ¥    % We call this a procedural representation, in which the data is represented by its action under . ¥ ¦¥  ¦ '  ¨¦ This turns out to be a useful technique in more situations than you might think, eg whenever the set of values being represented is a set of mathematical functions. 10 2.4 Lexical Scanning Programs are just strings of characters. Need to group these characters into meaningful...
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