On Jan 24, 2008 9:12 AM, David Brown <[EMAIL PROTECTED]> wrote: > On Thu, Jan 24, 2008 at 09:08:11AM -0800, Mark Schoonover wrote: > > >So, is Scheme normal or applicative order? Since it the interpretor simply > >kept going, it's telling me it's normal order. Funny thing is, it never quit > >running, you'd think it would eventually run out of memory or something. > >Maybe I didn't let it go long enough? > > Quoting SICP: > > This alternative ``fully expand and then reduce'' evaluation method is > known as normal-order evaluation, in contrast to the ``evaluate the > arguments and then apply'' method that the interpreter actually uses, > which is called applicative-order evaluation. > > Scheme is definitely applicative-order, as are most programming languages. > > Scheme requires a special performance characteristic concerning tail > recursion (which is discussed later). All scheme interpreters are required > to evaluate 'p' in such a way that it never consumes memory. In fact, this > technique is how we will later make loops.
This evaluation-order thig really tripped me up when I tried to go through SICP on my own a while ago, which is part of why I never got through 1.2 that time. So, am I getting this right? *Applicative order: evaluates each argument in order (both operator and operands are "arguments" in this sense), only looking at an argument farther down the line if it's called for. *Normal order: expand every argument to primitive data or functions, then reduce the expression by combining the primitives. -- Brad Beyenhof http://augmentedfourth.com The history of popular music is littered with great partnerships. Rodgers had his Hammerstein, Lennon had his McCartney, and Lloyd Webber had... his photocopier... ~Humphrey Lyttleton -- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg
