Ask your own question, for FREE!
MIT 6.001 Structure and Interpretation of Computer Programs, Spring 2005 25 Online
OpenStudy (anonymous):

I am pretty new with scheme and edwin and I have two questions (maybe observations?) 1 - When there is a block of code in the lecture with procedures referencing other procedures - does it matter which one is written first? Because it seems that it is always written that procedure A comes before procedure B in the code, even though procedure A is referencing procedure B. 2 - My next question is semi-related to the first: When you are defining a bunch of procedures that are all referencing eachother for some bigger "black box"-type procedure, IE the square root approximation procedure "s

OpenStudy (anonymous):

It would seem I was cut-off: the last procedure defined gets evaluated and the rest dont - then I retype and evaluate the other procedures inidivdually and then it all works. Any ideas why?

OpenStudy (anonymous):

1 - The order of definitions doesn't matter in Scheme. It matters in Clojure, sadly. The usual thinking process in Scheme goes like this: you define a function at a high level of abstraction. It uses a few lower level functions that need not even exist yet. You just practice "wishful thinking", pretending the lower level pieces are already defined. Next you define the lower level functions, similarly imagining that you already have all the more primitive functions, etc. 2 - Do you mean a list of local definitions inside another definition? In that case they don't exist in the global environment. You can call them from inside the outer procedure or from the local procedures. Your code listing would be helpful.

OpenStudy (anonymous):

For example, I type in these lines of code - separated byb Ctrl-J to move to the next line, (define plus (lambda (a b) (+ a b))) (define minus (lambda (a b) (- a b))) (define times (lambda (a b) (* a b))) Then I type: Ctrl-X Ctrl-E and I get: ;Value: times and when I try to use one of teh procedures IE: (plus 2 2) I get ;Unbound variable: plus but if I use Ctrl-X Ctrl-E between the above definitions they all work out. is that expected is all Im askin

OpenStudy (anonymous):

Yes, that is expected. You need Ctrl-X Ctrl-E after each definition. This key combination means "evaluate last s-expression". To evaluate all of them in one go, select the definitions, and press Ctrl-C Ctrl-R (means "evaluate region").

OpenStudy (anonymous):

yes that is the key: evaluate last s-expression".

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
MakaylaChuck23: Help wats this
5 hours ago 2 Replies 0 Medals
MakaylaChuck23: uh oh
8 hours ago 1 Reply 0 Medals
Treeko: Pics I took w my friend !
10 hours ago 6 Replies 2 Medals
Aliciaa: Is anyone elses QC going wack? Mine keeps freezing and stuff
8 hours ago 26 Replies 1 Medal
autumnp: does anyone have bandlab?
10 hours ago 4 Replies 0 Medals
Jeromeccv: Art for @vanessad123
7 hours ago 49 Replies 4 Medals
ohhhhhhhhhhhhhh: how do i slim my waist fast
10 hours ago 4 Replies 1 Medal
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!