<div dir="ltr">Thank-you all for your help with my Y-combinator question.<div><br></div><div>I've now got myself a copy of <i>The Little Schemer</i>, and think that i'm getting there. </div><div><br></div><div>Some googling on the lambda calculus and fixed point combinators introduced me the formalism:</div>
<div><br></div><div><span style="font-family:arial,sans-serif;font-size:13px">((lambda (x) (x x)) (lambda (x) (x x)))</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div>The general setting helped me see what was going on with (make-list make-list) etc ... in an abstract sense (i've never studied CS) however i do remain a little puzzled by Matthias' second hint: <span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><br></div><div><span style="font-family:arial,sans-serif;font-size:13px">"when you have an expression e and you know it will evaluate to a function if the evaluation terminates but it may not terminate, you can write (lambda (x) (e x)) to make sure that it is a function NOW. That way you can pass this quasi-e to another function and it can make the decision to evaluate it or not. </span><span style="font-family:arial,sans-serif;font-size:13px">If you had written the derivation in #lang lazy as opposed to #lang racket, you would not need this trick. In a lazy language e is passed as an argument without being evaluated to start with." </span><br>
</div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Why does (lambda (x) (e x)) make it evaluate once and stop? I mean how </span><span style="font-family:arial,sans-serif;font-size:13px">come when the evaluator gets to the call it doesn't get stuck in a loop?</span><span style="font-family:arial,sans-serif;font-size:13px"> </span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Additionally, chapter 8 is very interesting. I see that i can translate a simple recursive function the following way</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">(define (sum n)</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"> (if (zero? n)</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"> 0</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"> (+ n (sum (sub1 n)))))</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">(sum 10)</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">to </span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">(define (sum&co n k)</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"> (if zero? n)</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"> (k 0)</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"> (sum&co (sub1 n) (lambda (r) (k (+ n r))))))</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">(sum 10 (lambda (r) r))</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">but i really don't see why one would ever bother to do so. What are the benefits? the cost (hard to read / write / understand) seems high. </span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">thanks for your help (& further references appreciated). </span></div><div>
<span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">best regards</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">mj</span></div></div>