1
0
Fork 0
This commit is contained in:
Darcy Shen 2024-05-22 20:17:02 +08:00
parent 277099a83d
commit 59ba6676b8
1 changed files with 85 additions and 64 deletions

View File

@ -15,14 +15,26 @@
\;
<doc-data|<doc-title|\<#96F6\>\<#57FA\>\<#7840\>SICP
11>|<doc-author|<author-data|<author-name|>>>|<doc-author|<author-data|<author-name|\<#6C88\>\<#6D6A\>\<#718A\>\<#732B\>\<#513F\>>>>|<doc-author|<author-data|<author-name|MathAgape>|<\author-affiliation>
\;
<doc-data|<doc-title|\<#96F6\>\<#57FA\>\<#7840\>SICP
11>|<doc-author|<author-data|<author-name|>>>|<doc-author|<author-data|<author-name|\<#6C88\>\<#6D6A\>\<#718A\>\<#732B\>\<#513F\>>>>|<doc-author|<author-data|<author-name|MathAgape>>>|<doc-subtitle|\<#7B26\>\<#53F7\>\<#6570\>\<#636E\>\<#548C\>\<#7B26\>\<#53F7\>\<#6C42\>\<#5BFC\>>>
\;
\;
\;
\;
\;
\;
</author-affiliation>>>|<doc-subtitle|\<#7B26\>\<#53F7\>\<#6570\>\<#636E\>\<#548C\>\<#7B26\>\<#53F7\>\<#6C42\>\<#5BFC\>>>
</slide>
<\slide>
<tit|\<#96F6\>\<#57FA\>\<#7840\>SICP\<#FF1A\>\<#7B2C\>10\<#8BFE\>>
<tit|\<#96F6\>\<#57FA\>\<#7840\>SICP\<#FF1A\>\<#7B2C\>11\<#8BFE\>>
<\wide-tabular>
<tformat|<cwith|2|-1|1|-1|cell-height|40px>|<cwith|2|-1|1|-1|cell-vmode|exact>|<table|<row|<\cell>
@ -33,10 +45,18 @@
<\large>
<strong|Introduction to Data Abstraction>
</large>
</cell>>|<row|<\cell>
\;
</cell>|<\cell>
\;
</cell>>|<row|<\cell>
<large|<strong|\<#5C42\>\<#6B21\>\<#6027\>\<#6570\>\<#636E\>\<#548C\>\<#95ED\>\<#5305\>\<#6027\>\<#8D28\>>>
</cell>|<\cell>
<large|<strong|Hierarchical Data and the Closure Property>>
</cell>>|<row|<\cell>
\;
</cell>|<\cell>
\;
</cell>>|<row|<\cell>
<large|<strong|\<#7B26\>\<#53F7\>\<#6570\>\<#636E\>>>
</cell>|<\cell>
@ -108,7 +128,7 @@
<\input>
\<gtr\>\
<|input>
\;
(list? )
</input>
</session>
@ -120,7 +140,8 @@
<\slide>
<tit|\<#5B9A\>\<#4E49\>\<#7B26\>\<#53F7\>\<#6570\>\<#636E\>\V\<#6784\>\<#9020\>\<#51FD\>\<#6570\>quote>
<marked|<scm|'>>\<#662F\>\<#4E00\>\<#79CD\>\<#8BED\>\<#6CD5\>\<#7CD6\>\<#8863\>\<#FF0C\>\<#5982\>\<#679C\>\<#6CA1\>\<#6709\><marked|<scm|'>>\<#FF0C\>\<#4E5F\>\<#53EF\>\<#4EE5\>\<#4F7F\>\<#7528\><scm|quote>\<#3002\>Scala\<#91CC\>\<#9762\>\<#4E5F\>\<#6709\>\<#7B26\>\<#53F7\>\<#6570\>\<#636E\>\<#3002\>
<marked|<scm|'>>\<#662F\>\<#4E00\>\<#79CD\>\<#8BED\>\<#6CD5\>\<#7CD6\>\<#8863\>\<#FF0C\>\<#5982\>\<#679C\>\<#6CA1\>\<#6709\><marked|<scm|'>>\<#FF0C\>\<#4E5F\>\<#53EF\>\<#4EE5\>\<#4F7F\>\<#7528\><scm|quote>\<#3002\>Scala\<#91CC\>\<#9762\>\<#4E5F\>\<#6709\>\<#7B26\>\<#53F7\>\<#6570\>\<#636E\>\<#3002\>SRFI-1
List
<\with|par-columns|2>
<\session|s7|default>
@ -169,7 +190,7 @@
<|folded-io>
(eq? 1 (quote 1))
<|folded-io>
#t
#f
</folded-io>
<\folded-io>
@ -204,13 +225,13 @@
#f
</folded-io>
<\unfolded-io>
<\folded-io>
\<gtr\>\
<|unfolded-io>
<|folded-io>
''
<|unfolded-io>
<|folded-io>
#\<eof\>
</unfolded-io>
</folded-io>
<\input>
\<gtr\>\
@ -220,7 +241,9 @@
</session>
</with>
\<#5B57\>\<#9762\>\<#91CF\>\<#5728\>\<#5F15\>\<#7528\>\<#4E4B\>\<#540E\>\<#FF0C\>\<#8FD8\>\<#662F\>\<#5B57\>\<#9762\>\<#91CF\>\<#3002\>\<#7B26\>\<#53F7\>\<#5728\>\<#5F15\>\<#7528\>\<#4E4B\>\<#540E\>\<#FF0C\>\<#5219\>\<#53D8\>\<#6210\>\<#4E86\>\<#7B26\>\<#53F7\>\<#6570\>\<#636E\>\<#3002\>
\<#5B57\>\<#9762\>\<#91CF\>\<#FF08\>literally\<#FF09\>\<#5728\>\<#5F15\>\<#7528\>\<#FF08\>\<#4E24\>\<#6B21\>\<#5F15\>\<#7528\>\<#FF1F\>\<#FF09\>\<#4E4B\>\<#540E\>\<#FF0C\>\<#8FD8\>\<#662F\>\<#5B57\>\<#9762\>\<#91CF\>\<#3002\>\<#7B26\>\<#53F7\>\<#5728\>\<#5F15\>\<#7528\>\<#4E4B\>\<#540E\>\<#FF0C\>\<#5219\>\<#53D8\>\<#6210\>\<#4E86\>\<#7B26\>\<#53F7\>\<#6570\>\<#636E\>\<#3002\>
\;
</slide>
<\slide>
@ -274,20 +297,14 @@
<|folded-io>
(quasiquote (unquote a))
<|folded-io>
3
1
</folded-io>
<\input>
\<gtr\>\
<|input>
\;
</input>
</session>
\<#8BD5\>\<#8BD1\>\<#FF1A\>quote\<#4E3A\>\<#5F15\>\<#7528\>\<#FF0C\>unquote\<#4E3A\>\<#89E3\>\<#5F15\>\<#7528\>\<#FF0C\>quasiquote\<#4E3A\>\<#53CD\>\<#5E94\>\<#7528\>\<#3002\><marked|<scm|'>>
\<#8BD5\>\<#8BD1\>\<#FF1A\>quote\<#4E3A\>\<#5F15\>\<#7528\>\<#FF0C\>unquote\<#4E3A\>\<#89E3\>\<#5F15\>\<#7528\>\<#FF0C\>quasiquote\<#4E3A\>\<#51C6\>\<#5F15\>\<#7528\>\<#3002\><marked|<scm|'>>
\<#662F\>\<#5F15\>\<#53F7\>\<#FF0C\><marked|<scm|,>>
\<#662F\>\<#89E3\>\<#5F15\>\<#53F7\>\<#FF0C\><marked|<scm|`>>
\<#662F\>\<#53CD\>\<#5F15\>\<#53F7\>\<#3002\>
\<#662F\>\<#51C6\>\<#5F15\>\<#53F7\>\<#3002\>
</slide>
<\slide>
@ -342,21 +359,17 @@
</session>
<\scm-code>
' # quote
' ; quote
` # quasiquote
` ; quasiquote
, # unquote
, ; unquote
</scm-code>
\;
</slide>
<\slide>
<tit|\<#5B9A\>\<#4E49\>\<#7B26\>\<#53F7\>\<#6570\>\<#636E\>\V\<#5728\>\<#5217\>\<#8868\>\<#4E2D\>\<#7406\>\<#89E3\>\<#9009\>\<#62E9\>\<#51FD\>\<#6570\>>
\;
<\with|par-columns|2>
<\session|s7|default>
<\folded-io>
@ -370,9 +383,17 @@
<\folded-io>
\<gtr\>\
<|folded-io>
(define a 3)
(define a 4)
<|folded-io>
3
4
</folded-io>
<\folded-io>
\<gtr\>\
<|folded-io>
`(+ ,(+ a 1) 1)
<|folded-io>
(+ 5 1)
</folded-io>
<\folded-io>
@ -380,7 +401,7 @@
<|folded-io>
`(+ ,a 1)
<|folded-io>
(+ 3 1)
(+ 4 1)
</folded-io>
<\folded-io>
@ -388,14 +409,12 @@
<|folded-io>
(eval `(+ ,a 1))
<|folded-io>
4
5
</folded-io>
</session>
\;
<\equation*>
<frac|5+4+<around*|(|2-<around*|(|3-<around*|(|6+<frac|4|5>|)>|)>|)>|3<around*|(|6-2|)><around*|(|2-7|)>>
<frac|5+4+0*<around*|(|2-<around*|(|3-<around*|(|6+<frac|4|5>|)>|)>|)>|3<around*|(|6-2|)><around*|(|2-7|)>>
</equation*>
</with>
@ -455,29 +474,29 @@
<tit|\<#7B26\>\<#53F7\>\<#6C42\>\<#5BFC\>\V\<#5E94\>\<#7528\>>
<\session|s7|default>
<\input>
<\folded-io>
\<gtr\>\
<|input>
<|folded-io>
(deriv '(+ x 3) 'x)
</input>
<|folded-io>
(+ 1 0)
</folded-io>
<\input>
<\folded-io>
\<gtr\>\
<|input>
<|folded-io>
(deriv '(* x y) 'x)
</input>
<|folded-io>
(+ (* x 0) (* 1 y))
</folded-io>
<\input>
<\folded-io>
\<gtr\>\
<|input>
<|folded-io>
(deriv '(* (* x y) (+ x 3)) 'x)
</input>
<\input>
\<gtr\>\
<|input>
\;
</input>
<|folded-io>
(+ (* (* x y) (+ 1 0)) (* (+ (* x 0) (* 1 y)) (+ x 3)))
</folded-io>
</session>
<\session|maxima|default>
@ -495,35 +514,37 @@
</output>
<\folded-io>
<with|color|red|(<with|math-font-family|rm|%i>1) >
<with|color|red|(<with|math-font-family|rm|%i>4) >
<|folded-io>
diff(<math|x+3>)
<|folded-io>
<math|<with|math-display|true|<text|<with|font-family|tt|color|red|(<with|math-font-family|rm|%o1>)
<math|<with|math-display|true|<text|<with|font-family|tt|color|red|(<with|math-font-family|rm|%o4>)
>>d*x>>
</folded-io>
<\folded-io>
<with|color|red|(<with|math-font-family|rm|%i>2) >
<with|color|red|(<with|math-font-family|rm|%i>5) >
<|folded-io>
diff(<math|x*y>,x)
<|folded-io>
\;
\ <math|<with|math-display|true|<text|<with|font-family|tt|color|red|(<with|math-font-family|rm|%o2>)
<math|<with|math-display|true|<text|<with|font-family|tt|color|red|(<with|math-font-family|rm|%o5>)
>>y>>
</folded-io>
<\folded-io>
<with|color|red|(<with|math-font-family|rm|%i>3) >
<with|color|red|(<with|math-font-family|rm|%i>6) >
<|folded-io>
diff(<math|x*y*<around*|(|x+3|)>>,x)
<|folded-io>
\;
\ <math|<with|math-display|true|<text|<with|font-family|tt|color|red|(<with|math-font-family|rm|%o3>)
<math|<with|math-display|true|<text|<with|font-family|tt|color|red|(<with|math-font-family|rm|%o6>)
>><around*|(|x+3|)>*y+x*y>>
</folded-io>
<\input>
<with|color|red|(<with|math-font-family|rm|%i>7) >
<|input>
\;
</input>
</session>
</slide>
@ -531,9 +552,9 @@
<tit|\<#7B26\>\<#53F7\>\<#6C42\>\<#5BFC\>\V\<#5B9E\>\<#73B0\>>
<\session|s7|default>
<\folded-io>
<\unfolded-io>
\<gtr\>\
<|folded-io>
<|unfolded-io>
(define (deriv exp var)
\ \ (cond ((number? exp) 0)
@ -565,9 +586,9 @@
\ \ \ \ \ \ \ \ (else
\ \ \ \ \ \ \ \ \ (error "unknown expression type -- DERIV" exp))))
<|folded-io>
<|unfolded-io>
deriv
</folded-io>
</unfolded-io>
</session>
</slide>