What's the explanation for Exercise 1.6 in SICP?

前端 未结 6 507
一个人的身影
一个人的身影 2021-01-30 16:08

I\'m just beginning to work through SICP (on my own; this isn\'t for a class), and I\'ve been struggling with Exercise 1.6 for a couple of days and I just can\'t seem to figure

6条回答
  •  再見小時候
    2021-01-30 16:38

    First of all you have to understand the difference between applicative order evaluation and normal order. Lisp uses applicative order, but conditional expressions are evaluated not like normal functions (sicp chapter 1.1.6):

    (if   )
    

    To evaluate an if expression, the interpreter starts by evaluating the part of the expression. If the evaluates to a true value, the interpreter then evaluates the and returns its value. Otherwise it evaluates the and returns its value.

提交回复
热议问题