Giter Site home page Giter Site logo

sicp's Introduction

SICP 习题集

把 SICP 学了一遍,这里是我写的所有习题。

  • 第一章:26 道
  • 第二章:88 道
  • 第三章:81 道
  • 第四章:61 道
  • 第五章:21 道

共计:277 道。

写了一篇博客,介绍我的学习感受和一些心得:我如何用二十天刷完 SICP

注意

我没有完成全部习题,没做的那些题主要是:

  • 证明题:数量很少
  • 图表题:编辑器画不了图,我尽量用文字表示
  • 太难的题:主要集中在最后一章

此外,我的答案仅供参考。欢迎讨论交流,不欢迎喷。

开源协议

基于WTFPL协议开源。

sicp's People

Contributors

numbbbbb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sicp's Issues

Exercise 3.39 答案有误

题目见 http://sarabander.github.io/sicp/html/3_002e4.xhtml#Exercise-3_002e39

你的答案如下

; except two normal value, there are one special case
; second proc read x before first set! works (after square operator, because set! is not included in serializer), so result is 11.

但是我认为,那个 special case 的答案是 100, 而11的情况不会发生
网络上的其他资源也与我的判断一致:

我的思考过程是这样:

(lambda () (set! x ((s (lambda () (* x x))))))
(s (lambda () (set! x (+ x 1))))

第一行的函数会进行两个 process : 1. 计算新的值(计算新值的过程是 atomic 的,这一点由 serializer 保证)(我把这个操作记为p); 2. 赋值给x(我把这个操作记为q)
第二行的函数进行一个操作: 计算新值并赋值(整个过程是 atomic 的)(我把这个操作记作a)

如果整个程序以"paq"的顺序发生,那么结果就是100

(啊开学前看不完SICP要死了orz

e3-4 consecutive

We should reset the counter upon one successful login to fulfil consecutive requirement?

consider the following examples:

6 consecutive failed login
1 successful login
2 consecutive failed login -> will still call the cops

(btw thanks for the solutions and great writeup !)

e3.33 答案有误

; mit-scheme 没有nil这个概念,这道题本身就是错的
(define (map p sequence)
(accumulate (lambda (x y) (cons x (p y)) ) () sequence))

; 序列反了
(define (append seq1 seq2)
(accumulate cons seq2 seq1))

; 会报错,参数少一个
(define (length sequence)
(accumulate (lambda (x) (+ x 1)) 0 sequence))

e1-3 没有考虑相等的情况

(define (e13 a b c )
(cond ((and (<= a b) (<= a c)) (+ (square b) (square c)))
((and (<= b a) (<= b c)) (+ (square a) (square c)))
(else (+ (square a) (square b)))
)
)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.