Question dynamic scope? and tree representation? 

Forum: Com Sci 221, U Chicago, Autumn 2001, Old Classwork
Re: News Assignment #7 due Monday, 19 November (Mike O'Donnell)
Date: 2001, Nov 18
From: Terry (Sotiria) Lampoudi <slampoud@cs.uchicago.edu>

I'm a little confused about a few things in this week's homework; I'm terribly sorry if the below makes little sense:

First of all, regarding exercise 1, I'm having a hard time figuring out how static and dynamic scope are supposed to change the behavior of the supplied function. Specifically, I don't get it because it seems to me that evaluation order is all that should matter. So when I see a lambda I evaluate the second argument (the function), which in all of the lambdas I see is not actually a function of the formal parameter, so I pretty much ignore the formal parameter. So if there is no global scope and in each lambda the formal parameters are not used, then I don't quite see how dynamic vs lexical scope is going to matter.

Second, I'm a little lost with regard to the representation of a binary tree. For lists, inductively I have:
(a)    /\
      a  nil

(a b)  /\
      a /\
        b nil
and so on. Then how do I represent:
       /\
      a  b
It would seem that the natural notation would be:
((a)(b)), but then the list (a b) should be written ((a)((b)())).
I'm not sure this actually matters for problem 2, but it sure is throwing me into a loop.
Thanks,
---TL


Messages

1. Feedback But if it doesn't end with a nil... by Gregory Kettler, 2001, Nov 18
2. More Re: Tree Representation by Avi Schwab, 2001, Nov 18
1. Idea trees vs. lists by Roni Choudhury, 2001, Nov 18
3. Idea dynamic vs. static by Roni Choudhury, 2001, Nov 18
1. Agree I think that's it... by Matthew Stover, 2001, Nov 18
2. Feedback order of building lamda and subbing reals for fmls (Terry (Sotiria) Lampoudi), 2001, Nov 18
1. Idea My Evaluator by Mamun Tanveer, 2001, Nov 18
...
2. Feedback It's the order of substitution vs. application of the function by Mike O'Donnell, 2001, Nov 19
...
3. Agree Right, but remember the recursion stack by Mike O'Donnell, 2001, Nov 19
4. Feedback Lists subsetneq Trees by Mike O'Donnell, 2001, Nov 19

to: "dynamic scope? and tree representation?"