mirror of https://gitee.com/XmacsLabs/planet.git
slide 03
This commit is contained in:
parent
0d9c2504e1
commit
887ebf902f
143
SICP/slide03.tm
143
SICP/slide03.tm
|
@ -57,7 +57,87 @@
|
||||||
Tree Recursion
|
Tree Recursion
|
||||||
</cell>>>>
|
</cell>>>>
|
||||||
</wide-tabular>
|
</wide-tabular>
|
||||||
</shown>>
|
</shown>|<\hidden>
|
||||||
|
<tit|\<#6761\>\<#4EF6\>\<#8868\>\<#8FBE\>\<#5F0F\>\<#548C\>\<#8C13\>\<#8BCD\>\V\<#77ED\>\<#8DEF\>\<#8FD0\>\<#7B97\>>
|
||||||
|
|
||||||
|
<\itemize>
|
||||||
|
<item>\<#5E94\>\<#7528\>\<#5E8F\>\<#6C42\>\<#503C\>\<#FF08\>Scheme\<#4F7F\>\<#7528\>\<#7684\>\<#662F\>\<#5E94\>\<#7528\>\<#5E8F\>\<#6C42\>\<#503C\>\<#FF09\>
|
||||||
|
|
||||||
|
<item>\<#6B63\>\<#5219\>\<#5E8F\>\<#6C42\>\<#503C\>
|
||||||
|
</itemize>
|
||||||
|
|
||||||
|
<subparagraph|\<#6848\>\<#4F8B\>\<#5206\>\<#6790\>\<#FF1A\>\<#5B9E\>\<#73B0\>\<#6C42\>\<#7EDD\>\<#5BF9\>\<#503C\>\<#7684\>\<#591A\>\<#79CD\>\<#65B9\>\<#5F0F\>>
|
||||||
|
|
||||||
|
<\with|par-columns|2>
|
||||||
|
<\equation*>
|
||||||
|
<around|\||x|\|>=<around*|{|<tabular|<tformat|<cwith|1|-1|1|1|cell-halign|r>|<cwith|1|-1|2|2|cell-halign|l>|<cwith|1|-1|3|3|cell-halign|l>|<table|<row|<cell|x>|<cell|<with|mode|text|if>>|<cell|x\<gtr\>0,>>|<row|<cell|0>|<cell|<with|mode|text|if>>|<cell|x=0,>>|<row|<cell|-x>|<cell|<with|mode|text|if>>|<cell|x\<less\>0.>>>>>|\<nobracket\>>
|
||||||
|
</equation*>
|
||||||
|
|
||||||
|
<\session|scheme|default>
|
||||||
|
<\unfolded-io|Scheme] >
|
||||||
|
(define (abs1 x)
|
||||||
|
|
||||||
|
\ \ (cond ((\<gtr\> x 0) x)
|
||||||
|
|
||||||
|
\ \ \ \ \ \ \ \ ((= x 0) 0)
|
||||||
|
|
||||||
|
\ \ \ \ \ \ \ \ (else (- x))))
|
||||||
|
<|unfolded-io>
|
||||||
|
abs1
|
||||||
|
</unfolded-io>
|
||||||
|
|
||||||
|
<\unfolded-io|Scheme] >
|
||||||
|
(define (abs2 x)
|
||||||
|
|
||||||
|
\ \ (if (\<gtr\> x 0)
|
||||||
|
|
||||||
|
\ \ \ \ \ \ x
|
||||||
|
|
||||||
|
\ \ \ \ \ \ (- x)))
|
||||||
|
<|unfolded-io>
|
||||||
|
abs2
|
||||||
|
</unfolded-io>
|
||||||
|
|
||||||
|
<\unfolded-io|Scheme] >
|
||||||
|
(define (abs3 x)
|
||||||
|
|
||||||
|
\ \ (or (and (\<gtr\> x) x) (- x)))
|
||||||
|
<|unfolded-io>
|
||||||
|
abs3
|
||||||
|
</unfolded-io>
|
||||||
|
|
||||||
|
<\unfolded-io|Scheme] >
|
||||||
|
(abs1 1)
|
||||||
|
<|unfolded-io>
|
||||||
|
1
|
||||||
|
</unfolded-io>
|
||||||
|
|
||||||
|
<\unfolded-io|Scheme] >
|
||||||
|
(abs1 -1)
|
||||||
|
<|unfolded-io>
|
||||||
|
1
|
||||||
|
</unfolded-io>
|
||||||
|
|
||||||
|
<\input|Scheme] >
|
||||||
|
\;
|
||||||
|
</input>
|
||||||
|
</session>
|
||||||
|
</with>
|
||||||
|
|
||||||
|
<\folded>
|
||||||
|
<\question>
|
||||||
|
\<#4E3A\>\<#4EC0\>\<#4E48\><scm|if>\<#548C\><scm|cond>\<#662F\>\<#5FC5\>\<#987B\>\<#7684\>\<#FF1F\>
|
||||||
|
</question>
|
||||||
|
<|folded>
|
||||||
|
<\exercise>
|
||||||
|
\<#4F7F\>\<#7528\><scm|if>\<#5B9E\>\<#73B0\><scm|and>\<#548C\><scm|or>\<#3002\>
|
||||||
|
</exercise>
|
||||||
|
|
||||||
|
\<#53C2\>\<#8003\>\<#6587\>\<#6863\>\<#FF1A\><slink|https://www.scheme.com/tspl2d/grammar.html>
|
||||||
|
</folded>
|
||||||
|
|
||||||
|
\;
|
||||||
|
</hidden>>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
<\initial>
|
<\initial>
|
||||||
|
@ -66,70 +146,13 @@
|
||||||
<associate|marked-color|pastel yellow>
|
<associate|marked-color|pastel yellow>
|
||||||
<associate|page-medium|beamer>
|
<associate|page-medium|beamer>
|
||||||
<associate|page-screen-margin|false>
|
<associate|page-screen-margin|false>
|
||||||
|
<associate|par-columns|1>
|
||||||
<associate|preamble|false>
|
<associate|preamble|false>
|
||||||
</collection>
|
</collection>
|
||||||
</initial>
|
</initial>
|
||||||
|
|
||||||
<\references>
|
<\references>
|
||||||
<\collection>
|
<\collection>
|
||||||
<associate|auto-1|<tuple|?|?|slide01.tm>>
|
<associate|auto-1|<tuple|1|?>>
|
||||||
<associate|auto-10|<tuple|2|?|slide01.tm>>
|
|
||||||
<associate|auto-11|<tuple|1|?|slide01.tm>>
|
|
||||||
<associate|auto-12|<tuple|applicative order evaluation|?|slide01.tm>>
|
|
||||||
<associate|auto-13|<tuple|2|?|slide01.tm>>
|
|
||||||
<associate|auto-14|<tuple|normal order evaluation|?|slide01.tm>>
|
|
||||||
<associate|auto-15|<tuple|2|?|slide01.tm>>
|
|
||||||
<associate|auto-2|<tuple|normal order evaluation|?|slide01.tm>>
|
|
||||||
<associate|auto-3|<tuple|2|?|slide01.tm>>
|
|
||||||
<associate|auto-4|<tuple|2|?|slide01.tm>>
|
|
||||||
<associate|auto-5|<tuple|normal order evaluation|?|slide01.tm>>
|
|
||||||
<associate|auto-6|<tuple|2|?|slide01.tm>>
|
|
||||||
<associate|auto-7|<tuple|2|?|slide01.tm>>
|
|
||||||
<associate|auto-8|<tuple|2|?|slide01.tm>>
|
|
||||||
<associate|auto-9|<tuple|normal order evaluation|?|slide01.tm>>
|
|
||||||
</collection>
|
</collection>
|
||||||
</references>
|
</references>
|
||||||
|
|
||||||
<\auxiliary>
|
|
||||||
<\collection>
|
|
||||||
<\associate|figure>
|
|
||||||
<tuple|normal|<surround|<hidden-binding|<tuple>|1>||\<#64CD\>\<#4F5C\>\<#7B26\>\<#548C\>\<#64CD\>\<#4F5C\>\<#6570\>>|<pageref|auto-7>>
|
|
||||||
|
|
||||||
<tuple|normal|<surround|<hidden-binding|<tuple>|2>||\<#4E00\>\<#4E2A\>\<#5177\>\<#4F53\>\<#7684\>\<#4F8B\>\<#5B50\>>|<pageref|auto-8>>
|
|
||||||
</associate>
|
|
||||||
<\associate|gly>
|
|
||||||
<tuple|normal|primitive|\<#539F\>\<#8BED\>|<pageref|auto-1>>
|
|
||||||
|
|
||||||
<tuple|normal|expression|\<#8868\>\<#8FBE\>\<#5F0F\>|<pageref|auto-2>>
|
|
||||||
|
|
||||||
<tuple|normal|procedure|\<#51FD\>\<#6570\>|<pageref|auto-3>>
|
|
||||||
|
|
||||||
<tuple|normal|combination|\<#7EC4\>\<#5408\>|<pageref|auto-4>>
|
|
||||||
|
|
||||||
<tuple|normal|abstraction|\<#62BD\>\<#8C61\>|<pageref|auto-5>>
|
|
||||||
|
|
||||||
<tuple|normal|combinations|\<#7EC4\>\<#5408\>\<#5F0F\>|<pageref|auto-6>>
|
|
||||||
|
|
||||||
<tuple|normal|compound procedure|\<#590D\>\<#5408\>\<#51FD\>\<#6570\>|<pageref|auto-9>>
|
|
||||||
|
|
||||||
<tuple|normal|substitution model|\<#4EE3\>\<#6362\>\<#6A21\>\<#578B\>|<pageref|auto-10>>
|
|
||||||
|
|
||||||
<tuple|normal|applicative order evaluation|\<#5E94\>\<#7528\>\<#5E8F\>\<#6C42\>\<#503C\>|<pageref|auto-12>>
|
|
||||||
|
|
||||||
<tuple|normal|normal order evaluation|\<#6B63\>\<#5219\>\<#5E8F\>\<#6C42\>\<#503C\>|<pageref|auto-14>>
|
|
||||||
</associate>
|
|
||||||
<\associate|toc>
|
|
||||||
<with|par-left|<quote|3tab>|\<#5E94\>\<#7528\>\<#5E8F\>\<#6C42\>\<#503C\>
|
|
||||||
<datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
|
|
||||||
<no-break><pageref|auto-11>>
|
|
||||||
|
|
||||||
<with|par-left|<quote|3tab>|\<#6B63\>\<#5219\>\<#5E8F\>\<#6C42\>\<#503C\>
|
|
||||||
<datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
|
|
||||||
<no-break><pageref|auto-13>>
|
|
||||||
|
|
||||||
<vspace*|1fn><with|font-series|<quote|bold>|math-font-series|<quote|bold>|\<#672F\>\<#8BED\>\<#8868\>>
|
|
||||||
<datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
|
|
||||||
<no-break><pageref|auto-15><vspace|0.5fn>
|
|
||||||
</associate>
|
|
||||||
</collection>
|
|
||||||
</auxiliary>
|
|
Loading…
Reference in New Issue