From leavens@larch.cs.iastate.edu Mon Mar 28 21:51:12 2005 Date: Mon, 28 Mar 2005 21:51:11 -0600 (CST) From: Gary T. Leavens To: Matthew J. Ring Cc: Com S 342 TAs -- Brian Patterson , Daniel Patanroi Subject: Re: Hwk8, q8 Hi Matt, On Mon, 28 Mar 2005, Matthew J. Ring wrote: > I'm fairly lost on question 8 (implementing dynamic binding). I do > understand the conceptual process of *how* to dynamically bind. That's not > the problem. Ok. > I can't find in my notes where we talked about procedure texts - what are > they? I may just not be associating the term with something that is actually > in my notes. Can you provide some information on that. Otherwise, is there > anywhere else besides the four book exercises that I can get additional > information on dynamic binding that I can use to help me here? A procedure text is like a closure, except that it doesn't contain the environment. Another way to look at it is that a procedure text just doors the text of the procedure, namely the list of formal parameters and the body of the code in the form of an abstract syntax tree. Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 ---------------------- From leavens@larch.cs.iastate.edu Mon Mar 28 22:04:19 2005 Date: Mon, 28 Mar 2005 22:04:19 -0600 (CST) From: Gary T. Leavens To: Adam Nelson Cc: Com S 342 TAs -- Brian Patterson , Daniel Patanroi Subject: Re: Homework 8 Questions Hi Adam, On Mon, 28 Mar 2005, Adam Nelson wrote: > I have a few questions about problems 8 and 9 > > 8) Is text the constructor for the procedures? > If so, is apply-proctext as simple as doing eval-expression on the body? Yes. I thought the implementation of apply-proctext was even simpler, because we're using a procedural representation. > 9) What is the best way to start on this one? I think I have the datatype > defined, but I'm not sure what to do next. You have to think about how to evaluate the expression in the program in the right environment. I would work by analogy to how letrec works. Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 ---------------------------- From leavens@larch.cs.iastate.edu Wed Mar 30 21:46:12 2005 Date: Wed, 30 Mar 2005 21:46:12 -0600 (CST) From: Gary T. Leavens To: Brian Patterson Cc: Daniel Patanroi Subject: Re: why procedural to AST rep transform? Hi Brian, On Wed, 30 Mar 2005, Brian Patterson wrote: > I would like to hear from Gary (when he gets back) the reasons that learning > the AST representation and the procedural to AST transformation is so > important for this course. A student asked and I explained a little about > why it's easier for an interpreter/compiler to deal with ASTs than procedural > versions and how it graphically groups things but I'm sure there's better > reasons. I think he gets a bit more emphasis than perhaps necessary because students seem to have trouble with it. But I think the main importance is that you can consider the procedural version to be a specification, that happens to work because we're working in Scheme. The AST version is an implementation is that would work in any programming language. The other reason for the importance of this is that the book tends to use this technique over and over again for various examples. So it's important to understand what the authors are talking about. It's also useful as a general programming technique, for example in object-oriented programming to simulate lazy evaluation. Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580