• Advertisement
Sign in to follow this  

In lambdas in lambdas.... I don't quite understand.

This topic is 2093 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This is from SICP Video Lectures, Lecture 2a around the 39:51 mark.

(DEFINE SQRT X
(FIXED-POINT
(AVERAGE-DAMP (LAMBDA Y (/ X Y)))
1))

(DEFINE AVERAGE-DAMP
(LAMBDA f
(LAMBDA x (AVERAGE (f x) x))))



What does the `x` in the second lambda do in AVERAGE-DAMP and how is it being accessed? I don't understand what exactly is being passed to it. Edited by Alpha_ProgDes

Share this post


Link to post
Share on other sites
Advertisement
As far as I can see, AVERAGE-DAMP returns the second lambda to FIXED-POINT, which will feed data to x. The first lambda is just the AVERAGE-DAMP lambda. Hope that makes it a bit clearer!
Btw, the Y in sqrt, where does it come from? Maybe a typo?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement