From 387a5feb025946a746412cc06a0dfc00978717e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E6=B5=AA=E7=86=8A=E7=8C=AB=E5=84=BF?= Date: Wed, 31 Jan 2024 13:09:14 +0000 Subject: [PATCH] =?UTF-8?q?!41=20SICP=2001:=20=E7=BC=96=E7=A8=8B=E7=9A=84?= =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E5=8E=9F=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SICP/index.tm | 14 +- SICP/slide01.tm | 580 +++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 589 insertions(+), 5 deletions(-) diff --git a/SICP/index.tm b/SICP/index.tm index 7aabe8b..6c9093f 100644 --- a/SICP/index.tm +++ b/SICP/index.tm @@ -9,9 +9,19 @@ SICP\<#5B98\>\<#7F51\>\<#FF1A\> - \<#7B2C\>1\<#8BFE\>\<#FF1A\>\<#4E92\>\<#5F0F\>\<#8BFE\>\<#4EF6\>|https://gitee.com/XmacsLabs/interactive-sicp/raw/main/course01.tm>\<#3001\>\<#706F\>\<#7247\>|slide01.tm> + \<#7B2C\>1\<#8BFE\>\<#FF1A\>\<#7F16\>\<#7A0B\>\<#7684\>\<#57FA\>\<#672C\>\<#539F\>\<#7406\> - \<#7B2C\>0\<#8BFE\>\<#FF1A\>\<#706F\>\<#7247\>|slide00.tm> + \<#8BB2\>\<#4E49\>\<#FF1A\>\<#4E92\>\<#5F0F\>\<#8BB2\>\<#4E49\>|https://gitee.com/XmacsLabs/interactive-sicp/raw/main/course01.tm> + + \<#8BFE\>\<#4EF6\>\<#FF1A\>\<#706F\>\<#7247\>|slide01.tm> + + \<#8BFE\>\<#540E\>\<#FF1A\>\<#8BF7\>\<#5B8C\>\<#6210\>\<#8BB2\>\<#4E49\>\<#4E2D\>\<#7684\>\<#4E60\>\<#9898\> + + \<#7B2C\>0\<#8BFE\>\<#FF1A\>\<#51C6\>\<#5907\>Scheme\<#7F16\>\<#7A0B\>\<#7684\>\<#73AF\>\<#5883\> + + \<#8BFE\>\<#4EF6\>\<#FF1A\>\<#706F\>\<#7247\>|slide00.tm> + + \<#8BFE\>\<#540E\>\<#FF1A\>\<#8BF7\>\<#9884\>\<#4E60\>\<#7B2C\>1\<#8BFE\>\<#7684\>\<#8BB2\>\<#4E49\> diff --git a/SICP/slide01.tm b/SICP/slide01.tm index a164f9f..5efad8f 100644 --- a/SICP/slide01.tm +++ b/SICP/slide01.tm @@ -3,16 +3,590 @@ > <\body> + <\hide-preamble> + >>> + + \<#57FA\>\<#7840\>SICP\<#FF1A\>\<#7B2C\>1\<#8BFE\>> - \<#5907\>\<#8BFE\>\<#4E2D\> - > + \; + + <\wide-tabular> + || + + \<#7F16\>\<#7A0B\>\<#7684\>\<#57FA\>\<#672C\>\<#539F\>\<#7406\> + > + |<\cell> + + Elements of Programming + > + >| + \<#8868\>\<#8FBE\>\<#5F0F\> + |<\cell> + Expressions + >| + \<#547D\>\<#540D\>\<#4E0E\>\<#73AF\>\<#5883\> + |<\cell> + Naming and the Evironment + >| + \<#7EC4\>\<#5408\>\<#5F0F\>\<#7684\>\<#6C42\>\<#503C\> + |<\cell> + Evaluating Combinations + >| + \<#590D\>\<#5408\>\<#51FD\>\<#6570\> + |<\cell> + Compound Procedures + >| + \<#51FD\>\<#6570\>\<#5E94\>\<#7528\>\<#7684\>\<#4EE3\>\<#6362\>\<#6A21\>\<#578B\> + |<\cell> + The Subsitution Model for Procedure Application + >| + \<#6761\>\<#4EF6\>\<#8868\>\<#8FBE\>\<#5F0F\>\<#548C\>\<#8C13\>\<#8BCD\> + |<\cell> + Conditional Expressions and Predicates + >>> + + + \; + + \; + |<\hidden> + \<#7A0B\>\<#7684\>\<#57FA\>\<#672C\>\<#539F\>\<#7406\>> + + \; + + \; + + \; + + \; + + \; + + <\folded-documentation> + \<#7F16\>\<#7A0B\>\<#FF08\>\<#7A0B\>\<#5E8F\>\<#8BBE\>\<#8BA1\>\<#FF09\>\<#7684\>\<#57FA\>\<#672C\>\<#539F\>\<#7406\>>\<#4EC0\>\<#4E48\> + <|folded-documentation> + <\with|color|dark cyan|par-mode|center> + \<#6570\>\<#636E\>\<#548C\>\<#8BA1\>\<#7B97\>\<#7684\>\<#7EC4\>\<#5408\>\<#548C\>\<#62BD\>\<#8C61\>> + + + |<\hidden> + \<#7A0B\>\<#7684\>\<#57FA\>\<#672C\>\<#539F\>\<#7406\>> + + <\folded-documentation> + \<#57FA\>\<#672C\>\<#6982\>\<#5FF5\> + <|folded-documentation> + <\folded-std> + \<#539F\>\<#8BED\>\<#8BED\>> + <|folded-std> + <\itemize> + \<#6570\>\<#636E\>\<#539F\>\<#8BED\> + + \<#51FD\>\<#6570\>\<#539F\>\<#8BED\> + + + + <\folded-std> + \<#8868\>\<#8FBE\>\<#5F0F\>\<#8FBE\>\<#5F0F\>> + <|folded-std> + \<#539F\>\<#8BED\>\<#6216\>\<#8005\>\<#7EC4\>\<#5408\>\<#5F0F\> + + + <\folded-std> + \<#51FD\>\<#6570\> + <|folded-std> + <\definition> + \<#64CD\>\<#7EB5\>\<#6570\>\<#636E\>\<#FF08\>\<#8BA1\>\<#7B97\>\<#FF09\>\<#7684\>\<#89C4\>\<#5219\>\<#7684\>\<#63CF\>\<#8FF0\>\<#FF0C\>\<#79F0\>\<#4E3A\>\<#6570\>>\<#6570\>>\<#3002\>\<#51FD\>\<#6570\>\<#5206\>\<#4E3A\>\<#539F\>\<#8BED\>\<#51FD\>\<#6570\>\<#548C\>\<#590D\>\<#5408\>\<#51FD\>\<#6570\>\<#3002\> + + + + <\folded-std> + \<#7EC4\>\<#5408\>\<#5408\>> + <|folded-std> + \<#505A\>\<#7EC4\>\<#5408\> + + + <\folded-std> + \<#62BD\>\<#8C61\>\<#8C61\>> + \<#FF08\>\<#505A\>\<#62BD\>\<#8C61\>\<#FF09\> + <|folded-std> + \<#505A\>\<#62BD\>\<#8C61\> + + + + <\folded-documentation> + \<#57FA\>\<#672C\>\<#6982\>\<#5FF5\>\<#7684\>\<#56FE\>\<#793A\> + <|folded-documentation> + \<#8FBE\>\<#5F0F\>|\<#8BED\>|\<#6570\>\<#636E\>\<#539F\>\<#8BED\>|\<#51FD\>\<#6570\>\<#539F\>\<#8BED\>>|\<#5408\>\<#5F0F\>|(\<#8868\>\<#8FBE\>\<#5F0F\>0 + \<#8868\>\<#8FBE\>\<#5F0F\>1 \<#8868\>\<#8FBE\>\<#5F0F\>2 + \<#8868\>\<#8FBE\>\<#5F0F\>N)>> + + + \; + + \; + |<\hidden> + \<#8FBE\>\<#5F0F\>> + + <\definition> + \<#5728\>Scheme\<#8BED\>\<#8A00\>\<#4E2D\>\<#FF0C\>\<#5C06\>\<#4E00\>\<#7EC4\>\<#8868\>\<#8FBE\>\<#5F0F\>\<#653E\>\<#5728\>\<#5C0F\>\<#62EC\>\<#53F7\>\<#91CC\>\<#9762\>\<#5F62\>\<#6210\>\<#4E00\>\<#4E2A\>\<#65B0\>\<#7684\>\<#8868\>\<#8FBE\>\<#5F0F\>\<#4EE5\>\<#8868\>\<#793A\>\<#5E94\>\<#7528\>\<#4E00\>\<#4E2A\>\<#51FD\>\<#6570\>\<#FF0C\>\<#79F0\>\<#4E3A\>\<#7EC4\>\<#5408\>>\<#6216\>\<#8005\>\<#5408\>>\<#FF0C\>\<#800C\>\<#8FD9\>\<#7C7B\>\<#65B0\>\<#7684\>\<#8868\>\<#8FBE\>\<#5F0F\>\<#79F0\>\<#4E3A\>\<#5408\>\<#5F0F\>>\<#5408\>\<#5F0F\>>\<#3002\>\<#7EC4\>\<#5408\>\<#5F0F\>\<#4E2D\>\<#6700\>\<#5DE6\>\<#8FB9\>\<#7684\>\<#5143\>\<#7D20\>\<#79F0\>\<#4E3A\>\<#4F5C\>\<#7B26\>>\<#FF0C\>\<#5269\>\<#4E0B\>\<#7684\>\<#5143\>\<#7D20\>\<#662F\>\<#4F5C\>\<#6570\>>\<#3002\> + + + REPL\<#FF1A\> Loop + \<#8BFB\>\<#53D6\>\\<#6C42\>\<#503C\>\\<#6253\>\<#5370\> + \<#5FAA\>\<#73AF\> \<#FF08\>\<#4E3B\>\<#4F53\>\<#FF1A\>Scheme\<#89E3\>\<#91CA\>\<#5668\>\<#FF09\> + + <\session|scheme|default> + <\folded-io|Scheme] > + 486 ; \<#5341\>\<#8FDB\>\<#5236\> + <|folded-io> + 486 + + + <\folded-io|Scheme] > + (+ 137 349) ; \<#52A0\>\<#6CD5\> + <|folded-io> + 486 + + + <\folded-io|Scheme] > + (* 1 2 3) + <|folded-io> + 6 + + + <\folded-io|Scheme] > + (/ 3.0 2) + <|folded-io> + 1.5 + + + <\folded-io|Scheme] > + (+ (+ 1 3) (/ 3.0 2)) + <|folded-io> + 5.5 + + + <\input|Scheme] > + \; + + + + \<#4F5C\>\<#7B26\>|\<#7B2C\>1\<#4E2A\>\<#64CD\>\<#4F5C\>\<#6570\>|\<#7B2C\>2\<#64CD\>\<#4F5C\>\<#6570\>||\<#7B2C\>N\<#4E2A\>\<#64CD\>\<#4F5C\>\<#6570\>>|\<#64CD\>\<#4F5C\>\<#7B26\>\<#548C\>\<#64CD\>\<#4F5C\>\<#6570\>>|\<#4E00\>\<#4E2A\>\<#5177\>\<#4F53\>\<#7684\>\<#4F8B\>\<#5B50\>> + + \; + + \; + |<\hidden> + \<#540D\>\<#4E0E\>\<#73AF\>\<#5883\>> + + <\session|scheme|default> + <\folded-io|Scheme] > + (define pi 3.14159) + <|folded-io> + + + + <\folded-io|Scheme] > + (define \<#534A\>\<#5F84\> 1) + <|folded-io> + 1 + + + <\folded-io|Scheme] > + (* pi (* \<#534A\>\<#5F84\> \<#534A\>\<#5F84\>))\ + <|folded-io> + 3.141592653589793 + + + <\folded-io|Scheme] > + (define \<#5468\>\<#957F\> (* 2 (* pi \<#534A\>\<#5F84\>))) + <|folded-io> + 6.283185307179586 + + + <\folded-io|Scheme] > + \<#5468\>\<#957F\> + <|folded-io> + 6.283185307179586 + + + + \; + + <\with|par-columns|2> + |gr-frame|>|gr-geometry||gr-grid||gr-edit-grid-aspect|||>|gr-edit-grid||gr-grid-old||2>|gr-edit-grid-old||1>|gr-auto-crop|true||>|||>>|>|>|>>> + + <\equation*> + C=2*\*r + + + <\equation*> + S=\*r + + + |<\hidden> + \<#5408\>\<#5F0F\>\<#7684\>\<#6C42\>\<#503C\>> + + <\render-code> + \<#5BF9\>\<#7EC4\>\<#5408\>\<#5F0F\>\<#6C42\>\<#503C\>\<#FF08\>\<#9012\>\<#5F52\>\<#FF09\> + + \<#7B2C\>\<#4E00\>\<#6B65\>\<#FF1A\>\<#5BF9\>\<#7EC4\>\<#5408\>\<#5F0F\>\<#7684\>\<#5B50\>\<#8868\>\<#8FBE\>\<#5F0F\>\<#6C42\>\<#503C\> + + \<#7B2C\>\<#4E8C\>\<#6B65\>\<#FF1A\>\<#5BF9\>\<#53C2\>\<#6570\>\<#5E94\>\<#7528\>\<#51FD\>\<#6570\> + + + <\with|par-columns|2> + <\session|scheme|default> + <\folded-io|Scheme] > + (* (+ 2 (* 4 6)) + + \ \ \ (+ 3 5 7)) ; \<#7EC4\>\<#5408\>\<#5F0F\> + <|folded-io> + 390 + + + <\input|Scheme] > + (* + + \ \ \ (+ 3 5 7)) + + + <\input|Scheme] > + (* (+ 2 ) + + \ \ \ (+ 3 5 7)) + + + <\input|Scheme] > + (* (+ 2 24) + + \ \ \ (+ 3 5 7)) + + + <\input|Scheme] > + (* + + \ \ \ (+ 3 5 7)) + + + <\input|Scheme] > + (* 26 + + \ \ \ (+ 3 5 7)) + + + <\input|Scheme] > + (* 26 + + \ \ \ ) + + + <\folded-io|Scheme] > + (* 26 15) ; \<#7B2C\>\<#4E00\>\<#6B65\>\<#5DF2\>\<#5B8C\>\<#6210\> + <|folded-io> + 390 + + + <\input|Scheme] > + 390 ; \<#7B2C\>\<#4E8C\>\<#6B65\>\<#5DF2\>\<#5B8C\>\<#6210\> + + + + + >|> + |<\hidden> + \<#5408\>\<#51FD\>\<#6570\>\<#5408\>\<#51FD\>\<#6570\>>> + + \<#51FD\>\<#6570\>\<#5206\>\<#4E3A\>\<#4E24\>\<#79CD\>\<#FF0C\>\<#539F\>\<#8BED\>\<#51FD\>\<#6570\>\<#548C\>\<#590D\>\<#5408\>\<#51FD\>\<#6570\>\<#3002\>\<#6BD4\>\<#5982\>\<#52A0\>\<#51CF\>\<#4E58\>\<#9664\>\<#5C31\>\<#662F\>\<#539F\>\<#8BED\>\<#51FD\>\<#6570\>\<#3002\>\<#7531\>\<#7528\>\<#6237\>\<#81EA\>\<#5B9A\>\<#4E49\>\<#7684\>\<#51FD\>\<#6570\>\<#79F0\>\<#4E3A\>\<#590D\>\<#5408\>\<#51FD\>\<#6570\>\<#3002\> + + <\equation*> + \<#6C42\>\<#5E73\>\<#65B9\>=x + + + <\session|scheme|default> + <\folded-io|Scheme] > + (define (\<#6C42\>\<#5E73\>\<#65B9\> x) (* x x)) + <|folded-io> + \#6C42\\#5E73\\#65B9\ + + + <\folded-io|Scheme] > + (\<#6C42\>\<#5E73\>\<#65B9\> 3) + <|folded-io> + 9 + + + <\input|Scheme] > + \; + + + + <\scm-code> + (define (\<#51FD\>\<#6570\>\<#540D\>\ + >\<#5F62\>\<#5F0F\>\<#53C2\>\<#6570\>\<#5217\>\<#8868\>\>) + \<#4E3B\>\<#4F53\>\>) + + + <\equation*> + \<#6C42\>\<#5E73\>\<#65B9\>\<#548C\>=x+y + + + <\session|scheme|default> + <\folded-io|Scheme] > + (define (\<#6C42\>\<#5E73\>\<#65B9\>\<#548C\> x y) (+ + (\<#6C42\>\<#5E73\>\<#65B9\> x) (\<#6C42\>\<#5E73\>\<#65B9\> y))) + <|folded-io> + \#6C42\\#5E73\\#65B9\\#548C\ + + + <\folded-io|Scheme] > + (\<#6C42\>\<#5E73\>\<#65B9\>\<#548C\> 1 2) + <|folded-io> + 5 + + + <\input|Scheme] > + \; + + + + \; + |<\hidden> + \<#7528\>\<#4E00\>\<#4E2A\>\<#51FD\>\<#6570\>\<#7684\>\<#4EE3\>\<#6362\>\<#6A21\>\<#578B\>\<#6362\>\<#6A21\>\<#578B\>>\<#2014\>\<#2014\>\<#6B63\>\<#5E38\>\<#5E8F\>\<#6C42\>\<#503C\>> + + \; + + <\equation*> + f=+2|)> + + + <\session|scheme|default> + <\folded-io|Scheme] > + (define (f a) (\<#6C42\>\<#5E73\>\<#65B9\>\<#548C\> (+ a 1) (* a 2))) + <|folded-io> + f + + + <\folded-io|Scheme] > + (f 5) + <|folded-io> + 136 + + + <\input|Scheme] > + \; + + + + <\itemize> + \<#5BF9\>\<#7EC4\>\<#5408\>\<#5F0F\>(f 5)\<#6C42\>\<#503C\> + + \<#5C06\>\<#51FD\>\<#6570\>f\<#5E94\>\<#7528\>\<#5230\>\<#53C2\>\<#6570\>5\<#4E0A\>\<#9762\>\<#FF08\>\<#6CE8\>\<#610F\>\<#53C2\>\<#6570\>\<#3001\>\<#5F62\>\<#5F0F\>\<#53C2\>\<#6570\>\<#3001\>\<#64CD\>\<#4F5C\>\<#6570\>\<#8FD9\>\<#4E09\>\<#4E2A\>\<#6982\>\<#5FF5\>\<#7684\>\<#533A\>\<#522B\>\<#FF09\> + + + \<#5E38\>\<#5E8F\>\<#6C42\>\<#503C\>> + + <\folded-std> + \<#5E73\>\<#65B9\>\<#548C\> + )> + <|folded-std> + <\folded-std> + \<#5E73\>\<#65B9\>\<#548C\> + )> + <|folded-std> + <\folded-std> + \<#5E73\>\<#65B9\>\<#548C\> 6 10)>> + <|folded-std> + <\folded-std> + \<#5E73\>\<#65B9\> 6)> + \<#5E73\>\<#65B9\> 10)>)> + <|folded-std> + <\folded-std> + )> + <|folded-std> + <\folded-std> + + <|folded-std> + 136 + + + + + + + |<\hidden> + \<#7528\>\<#4E00\>\<#4E2A\>\<#51FD\>\<#6570\>\<#7684\>\<#4EE3\>\<#6362\>\<#6A21\>\<#578B\>\<#2014\>\<#2014\>\<#5E94\>\<#7528\>\<#5E8F\>\<#6C42\>\<#503C\>> + + \<#7528\>\<#5E8F\>\<#6C42\>\<#503C\>> + + <\folded-std> + (\<#6C42\>\<#5E73\>\<#65B9\>\<#548C\> (+ 1) (* + 2)) + <|folded-std> + <\folded-std> + (\<#5E73\>\<#65B9\>\<#548C\>> (+ 5 1) (* 5 + 2)) + <|folded-std> + <\folded-std> + (+ \<#5E73\>\<#65B9\> (+ 5 1))> + \<#5E73\>\<#65B9\> (* 5 2)>) + <|folded-std> + <\folded-std> + (+ (* (+ 5 1) (+ 5 1)) (* (* 5 2) (* 5 2))) + <|folded-std> + <\folded-std> + (+ 36 100) + <|folded-std> + 136 + + + + + + + <\question> + \<#5DF2\>\<#7ECF\>\<#6709\>\<#4E86\>\<#6B63\>\<#5E38\>\<#5E8F\>\<#6C42\>\<#503C\>\<#FF0C\>\<#4E3A\>\<#4EC0\>\<#4E48\>\<#8FD8\>\<#9700\>\<#8981\>\<#5E94\>\<#7528\>\<#5E8F\>\<#6C42\>\<#503C\>\<#FF1F\> + + + <\question> + \<#6A21\>\<#578B\>\<#662F\>\<#4EC0\>\<#4E48\>\<#610F\>\<#601D\>\<#FF1F\>\<#548C\>\<#73B0\>\<#5728\>\<#5A92\>\<#4F53\>\<#4E0A\>\<#8BB2\>\<#7684\>\<#5927\>\<#6A21\>\<#578B\>\<#6709\>\<#4EC0\>\<#4E48\>\<#533A\>\<#522B\>\<#3002\> + + |<\hidden> + \<#4EF6\>\<#8868\>\<#8FBE\>\<#5F0F\>\<#548C\>\<#8C13\>\<#8BCD\>> + + <\equation*> + =||||>|0,>>||>|>||>|0.>>>>>|\> + + + <\session|scheme|default> + <\folded-io|Scheme] > + (define (\<#6C42\>\<#7EDD\>\<#5BF9\>\<#503C\> x) + + \ \ (cond ((\ x 0) x) + + \ \ \ \ \ \ \ \ ((= x 0) 0) + + \ \ \ \ \ \ \ \ ((\ x 0) (- x)))) + <|folded-io> + \#6C42\\#7EDD\\#5BF9\\#503C\ + + + <\folded-io|Scheme] > + (\<#6C42\>\<#7EDD\>\<#5BF9\>\<#503C\> 1) + <|folded-io> + 1 + + + <\input|Scheme] > + \; + + + + <\scm-code> + (cond (\\<#8C13\>\<#8BCD\>1\ + \\<#8868\>\<#8FBE\>\<#5F0F\>1\) + + \ \ \ \ \ \ (\\<#8C13\>\<#8BCD\>2\ + \\<#8868\>\<#8FBE\>\<#5F0F\>2\) + + \ \ \ \ \ \ ... + + \ \ \ \ \ \ (\\<#8C13\>\<#8BCD\>N\ + \\<#8868\>\<#8FBE\>\<#5F0F\>N\)) + + |<\hidden> + \<#7ED3\>> + + \; + + <\the-glossary|gly> + \<#8BED\>|> + + \<#8FBE\>\<#5F0F\>|> + + \<#6570\>|> + + \<#5408\>|> + + \<#8C61\>|> + + \<#5408\>\<#5F0F\>|> + + \<#5408\>\<#51FD\>\<#6570\>|> + + \<#6362\>\<#6A21\>\<#578B\>|> + + > <\initial> <\collection> + + + - \ No newline at end of file + + +<\references> + <\collection> + > + > + > + > + > + > + > + > + > + > + > + > + > + + + +<\auxiliary> + <\collection> + <\associate|figure> + |1>||\<#64CD\>\<#4F5C\>\<#7B26\>\<#548C\>\<#64CD\>\<#4F5C\>\<#6570\>>|> + + |2>||\<#4E00\>\<#4E2A\>\<#5177\>\<#4F53\>\<#7684\>\<#4F8B\>\<#5B50\>>|> + + <\associate|gly> + \<#8BED\>|> + + \<#8FBE\>\<#5F0F\>|> + + \<#6570\>|> + + \<#5408\>|> + + \<#8C61\>|> + + \<#5408\>\<#5F0F\>|> + + \<#5408\>\<#51FD\>\<#6570\>|> + + \<#6362\>\<#6A21\>\<#578B\>|> + + <\associate|toc> + |\<#6B63\>\<#5E38\>\<#5E8F\>\<#6C42\>\<#503C\> + |.>>>>|> + > + + |\<#5E94\>\<#7528\>\<#5E8F\>\<#6C42\>\<#503C\> + |.>>>>|> + > + + |math-font-series||\<#672F\>\<#8BED\>\<#8868\>> + |.>>>>|> + + + + \ No newline at end of file