Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Normal Order vs. Applicative Order

Name: Anonymous 2013-07-01 22:38

Fucking SICP does a piss-poor job of explaining this, and the cunts on /g/ are too busy creating threads about the fucking Macbook Air to answer the two separate threads I created about this today.

I am stuck on this concept for two days. Yes, I _am_ a retard but that's beside the point. Does anyone want to help me conceptually understand this using Excercise 1.5 in SICP? I'm pasting it below:

**********
Ben Bitdiddle has invented a test to determine whether the interpreter he is faced with is using applicative-order evaluation or normal-order evaluation. He defines the following two procedures:

(define (p) (p))

(define (test x y)
  (if (= x 0)
      0
      y))

Then he evaluates the expression

(test 0 (p))

What behavior will Ben observe with an interpreter that uses applicative-order evaluation? What behavior will he observe with an interpreter that uses normal-order evaluation? Explain your answer. (Assume that the evaluation rule for the special form 'if' is the same whether the interpreter is using normal or applicative order: The predicate expression is evaluated first, and the result determines whether to evaluate the consequent or the alternative expression.)
**********

I can't for the life of me decipher what GJ Sussman means by his confounding use of the words 'apply', 'evaluate', 'expand' and 'reduce' in the relevant section of the book.

Elsewhere on the internet, the solutions say that since Scheme uses Applicative Order (= "evaluate arguments then apply"), (test 0 (p)) does not terminate... and I understand that, I think. But it shouldn't terminate even if Scheme used Normal Order, because Normal Order = "fully expand, then reduce". Now (p) is defined as itself, so trying to "fully expand" (p) shouldn't ever terminate.

But then he springs this on me: Normal Order is also "...An alternative evaluation model [that does not] evaluate the operands until their values [are] needed." So Normal Order is also the same as Lazy Evaluation?

There's surely a gap in my thinking process, but for fuck's sake, where is it?? PLEASE HELP.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List