Questions tagged [sicp]

SICP is the book Structure and Interpretation of Computer Programs by Harold Abelson and Gerald Jay Sussman with Julie Sussman and published by the MIT Press.

Quoting the wikipedia page:

Structure and Interpretation of Computer Programs (SICP) is a textbook published in 1984 about general computer programming concepts from MIT Press written by Massachusetts Institute of Technology (MIT) professors Harold Abelson and Gerald Jay Sussman, with Julie Sussman. It was formerly used as the textbook of MIT introductory programming class and at other schools.

Using a dialect of the Lisp programming language known as Scheme, the book explains core computer science concepts, including abstraction, recursion, interpreters and metalinguistic abstraction, and teaches modular programming.

The book is available online, with accompanying video lectures.

660 questions
4
votes
2 answers

SICP - Imperative versus Functional implementation of factorial

I am studying the SICP book with Racket and Dr. Racket. I am also watching the lectures on:…
user4206400
4
votes
3 answers

How to install sicp package module in racket?

I'm newbie in programming world. I'm using ubuntu OS. I have started my journey with sicp book. I'm working with scheme repl. But suddenly I get stuck with section 2.2.4 I'm not able to execute it's example with scheme repl. I tried to run given…
Amit
  • 861
  • 1
  • 9
  • 18
4
votes
2 answers

SICP, Scheme, DrRacket Question: Timer/profiler function?

I'm currently trying to do exercise 1.22, which needs a function called runtime that returns the number of milliseconds the system has been running. However, my environment (R5RS) does not seem to have this. It does not have time,…
KnowsLittle
  • 1,197
  • 2
  • 13
  • 20
4
votes
1 answer

Storing procedure in environment of evaluator leads to infinite loop

I converted the Structure and Interpretation of Computer Programs (SICP) version of the meta-circular evaluator to Clojure. The main difference (besides syntax) is the handling of the environment structure. Since you cannot use set-car! and set-cdr!…
user2609980
  • 10,264
  • 15
  • 74
  • 143
4
votes
1 answer

Attempting to call unbound fn, while I have defined it

I am trying to convert SICP's meta-circular evaluator to Clojure. In setup-environment a call to extend-environment does not compile because I get the error "Attempting to call unbound fn". Here's part of the code: (... loads of methods for creating…
user2609980
  • 10,264
  • 15
  • 74
  • 143
4
votes
2 answers

fibonacci sequence using iterative process in SICP, cannot completely understand

Here is an iterative example of a procedure computing the fibonacci sequence in SICP. The idea is: a = fib(n+1) = a+b b = fib(n) = a (define (fib n) (fib-iter 1 0 n)) (define (fib-iter a b count) (if (= count 0) b (fib-iter (+ a…
lightning_missile
  • 2,821
  • 5
  • 30
  • 58
4
votes
4 answers

Why is it legal in a function definition to make self-call but illegal for a value?

Structure and Interpretation of Computer Programs (SICP) 3.5.2 introduces infinite streams: (define ones (cons-stream 1 ones)) This code doesn't work in DrRacket, with the error: ones: undefined; cannot reference an identifier before its…
Rahn
  • 4,787
  • 4
  • 31
  • 57
4
votes
1 answer

Understanding bound and free variables in LISP

I'm reading SICP, and the topic of bound and free variables has come up. However, I am confused about it. Does the term "bound variables" only apply to variables that are formal parameters? In addition, the text says that a procedure definition…
Wesley
  • 1,217
  • 3
  • 12
  • 16
4
votes
1 answer

Difference between computational processes and procedures?

I am delving into Structure and Interpretation of Computer Programs. Right off the bat, there are two words being used that seem to denote some specific concepts: computational processes and procedures. I have a simple question. What are the…
Wesley
  • 1,217
  • 3
  • 12
  • 16
4
votes
1 answer

Scheme - Using cons properly to create lists

I've been trying to solve exercise 2.20 of SICP, where "dotted-tail" notation is introduced. My problem is that, instead of returning a proper list with results, my function returns a nested list. I know that there is something wrong with the way…
Daniel
  • 11,332
  • 9
  • 44
  • 72
4
votes
2 answers

Why languages such as C, Pascal cannot implement tail recursion?

I'm reading SICP. It is mentioned in one of the footnote that: Making a compiler generate tail-recursive code might seem like a straightforward idea. But most compilers for common languages, including C and Pascal, do not do this, and therefore…
Anurag Peshne
  • 1,547
  • 12
  • 29
4
votes
1 answer

How do you find where an error has occurred in MIT scheme?

When you get an error in MIT scheme it doesn't tell you where the error occurred. For example, it just prints something like this: ;Unbound variable: top-left ;To continue, call RESTART with an option number: ; (RESTART 3) => Specify a value to use…
user2355213
  • 447
  • 4
  • 13
4
votes
1 answer

Three questions w.r.t. the environment model of evaluation

I am reading the SICP book Here about the imperative programming model. I could not understand the illustration in two points: W.r.t. the arrow from square to the "pair" (the two circles): What does this arrow mean? Though throughout this section,…
modeller
  • 3,770
  • 3
  • 25
  • 49
4
votes
4 answers

What is fixed point?

I'm rewatching some of the earlier lectures on SICP. The notion of a fixed-point is a bit confusing to me. The fixed-point procedure: should I be thinking about it this way, "it's the way to find a fixed-point of a given function." So given f(2) =…
4
votes
2 answers

Little languages similar to the "picture language" in SICP

SICP section 2.2.4 describes a little "picture language" to build complicated image patters. The language defines a single primitive painter to draw an image within a given frame and functions to transform and combine painters to create a new…
Michael
  • 41,026
  • 70
  • 193
  • 341