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
1 answer

Can 'programming without assignment' be considered within the definition of functional programming?

I'm aware that there are several definitions for functional programming. I think it's a nebulous category. My personal definition is something close to 'referential transparency'. This question is not 'What is the definition of functional…
hawkeye
  • 34,745
  • 30
  • 150
  • 304
4
votes
1 answer

SICP exercise 1.19

It's a procedure to genearate the fibonacci numbers, here is the reference: http://sicp.org.ua/sicp/Exercise1-19 it's said that we can consider the procedure as "a <- bq + aq + ap and b <- bp + aq".My question is how the auther(or someone else)…
Kevin xue
  • 53
  • 3
4
votes
1 answer

the difference between if and cond?

i'm learning sicp now and do the ex2.23 i have wrirten the following code: (define (for-each proc items) (if (null? items) #t ((proc (car items)) (for-each proc (cdr items))))) but when running, cause error: procedure…
Vincent
  • 141
  • 1
  • 2
  • 15
4
votes
1 answer

Is it an idea of OOP?

I have learned data-directed programming from the chapter 2.4 of the SICP, and then I continued to study the chapter 2.5. When I saw the "Tower of types" and "inherit", an thought flashed, is it an idea of OOP? Each package is an object and the…
yuliu
  • 913
  • 1
  • 6
  • 8
4
votes
2 answers

Scheme, N-queens optimization strategies SICP chapter 2

SICP contains an partially complete example of the n-queens solutions, by walking a tree of every possible queen placement in the last row, generating more possible positions in the next row to combine the results so far, filtering the possibilities…
WorBlux
  • 1,423
  • 11
  • 20
4
votes
1 answer

confused in a macro definition

I want to implement the lazy stream in SICP section 3.5.1 Firstly, I defined this two functions (defmacro delay (form) `(lambda () ,form)) (defun force (form) (when form (funcall form))) When we called: (force (delay '(+ 1 2))) ;;=> (+ 1…
xiepan
  • 623
  • 4
  • 13
4
votes
1 answer

How transform-painter works in the picture language in SICP

In the picture language in SICP I'm having trouble understanding how the transform-painter procedure works: (define (transform-painter painter origin corner1 corner2) (lambda (frame) (let ((m (frame-coord-map frame))) (let ((new-origin…
Michael Tedla
  • 1,079
  • 1
  • 12
  • 19
4
votes
3 answers

How frames are used in the picture language in SICP?

I can't seem to get my head around the implementation of frames in SICP. The book states We will use coordinates in the unit square (0< x,y< 1) to specify images How are images expressed as coordinates? The only interpretation I can muster is that…
Michael Tedla
  • 1,079
  • 1
  • 12
  • 19
4
votes
2 answers

Error: Can't bind name in null syntactic environment

I'm currently going through exercise 1.3 of the sicp book. Here's the description of the problem: Define a procedure that takes three numbers as arguments and returns the sum of the squares of the two larger numbers. I tried to solve it with the…
Kiet Tran
  • 1,458
  • 2
  • 13
  • 22
4
votes
1 answer

Writing a Scheme interpreter with FPC: Allocation and Pointers

Being a historian, writing a Scheme interpreter in FPC turns already in the first stage out to be a serious task for me. :) I am following the blog of Peter Michaux, who showed how to do it in C (there is also a translation to Ada, which may be…
user1710139
4
votes
5 answers

Count amount of odd numbers in a sentence

I am fairly new to lisp and this is one of the practice problems. First of all, this problem is from simply scheme. I am not sure how to answer this. The purpose of this question is to write the function, count-odd that takes a sentence as its…
Bob Parker
  • 41
  • 3
4
votes
3 answers

Racket Lisp : comparison between new-if and if

(define (sqrt-iter guess x) (if (good-enough? guess x) guess (sqrt-iter(improve guess x) x))) (define (improve guess x) (average guess(/ x guess))) (define (average x y) (/ (+ x y) 2)) (define…
Jerry Zhao
  • 265
  • 4
  • 10
4
votes
1 answer

What are the pre-conditions of reading SICP?

right now i have got suggestions like "Simply scheme" and "The little schemer". what others are available?
Cui Pengfei 崔鹏飞
  • 8,017
  • 6
  • 46
  • 87
4
votes
1 answer

example of underscore.js _.memoize() in action?

Can anyone give me an example of underscore.js _.memoize() in action? Preferably using the hashFunction, and even more preferably in coffeescript? Here is a slightly modified version of that cute change counting function from SICP in…
James
  • 641
  • 8
  • 17
3
votes
2 answers

Metacircular evaluator, implementing the environment

I am trying to implement the Metacircular Evaluator in Scheme according to the well-known book "Structure and Interpretation of Computer Programs" by Harold Abelson and Gerald Jay…
Yura Perov
  • 105
  • 1
  • 1
  • 7