大小: 2129
备注:
|
大小: 421
备注:
|
删除的内容标记成这样。 | 加入的内容标记成这样。 |
行号 2: | 行号 2: |
参考文献:http://mitpress.mit.edu/sicp/full-text/book/book.html |
|
行号 3: | 行号 5: |
== The Elements of Programming == === Expressions === {{{ 486 }}} {{{#!python 486 }}} {{{ (+ 137 349) 486 (- 1000 334) 666 (* 5 99) 495 (/ 10 5) 2 (+ 2.7 10) 12.7 }}} {{{#!python 137 + 349 1000 - 334 5 * 99 10 / 5 2.7 + 10 }}} {{{ (+ 21 35 12 7) 75 |
[[Include(/SICP的Python实现1.1)]] [[Include(/SICP的Python实现1.2)]] [[Include(/SICP的Python实现1.3)]] = Building Abstractions with Data = = Modularity, Objects, and State = = Metalinguistic Abstraction = = Computing with Register Machines = |
行号 34: | 行号 13: |
(* 25 4 12) 1200 }}} {{{#!python 21 + 35 + 12 + 7 25 * 4 * 12 }}} 或者{{{ reduce(int.__add__, [21, 35, 12, 7]) reduce(int.__mul__, [25, 4, 12]) }}} {{{ (+ (* 3 5) (- 10 6)) 19 }}} {{{#!python (3 * 5) + (10 - 6) }}} {{{ (+ (* 3 (+ (* 2 4) (+ 3 5))) (+ (- 10 7) 6)) }}} {{{#!python (3 * ((2*4)+(3+5)) ) + ((10-7)+6) }}} === Naming and the Environment === {{{ (define size 2) }}} {{{#!python size = 2 }}} {{{ size 2 (* 5 size) 10 }}} {{{#!python size 5 * size }}} {{{ (define pi 3.14159) (define radius 10) (* pi (* radius radius)) 314.159 (define circumference (* 2 pi radius)) circumference 62.8318 }}} {{{#!python pi = 3.14159 radius = 10 pi * (radius * radius) circumference = 2 * pi * radius circumference }}} === Evaluating Combinations === {{{ (* (+ 2 (* 4 6)) (+ 3 5 7)) }}} {{{#!python (2+(4*6)) * (3+5+7) }}} 1.1.4 Compound Procedures 1.1.5 The Substitution Model for Procedure Application 1.1.6 Conditional Expressions and Predicates 1.1.7 Example: Square Roots by Newton's Method 1.1.8 Procedures as Black-Box Abstractions 1.2 Procedures and the Processes They Generate 1.2.1 Linear Recursion and Iteration 1.2.2 Tree Recursion 1.2.3 Orders of Growth 1.2.4 Exponentiation 1.2.5 Greatest Common Divisors 1.2.6 Example: Testing for Primality 1.3 Formulating Abstractions with Higher-Order Procedures 1.3.1 Procedures as Arguments 1.3.2 Constructing Procedures Using Lambda 1.3.3 Procedures as General Methods 1.3.4 Procedures as Returned Values |
[[Navigation(children)]] |
TableOfContents 参考文献:http://mitpress.mit.edu/sicp/full-text/book/book.html
Building Abstractions with Procedures
Include(/SICP的Python实现1.1) Include(/SICP的Python实现1.2) Include(/SICP的Python实现1.3)
Building Abstractions with Data
Modularity, Objects, and State
Metalinguistic Abstraction