1
0
Fork 0
planet/SICP/slide03.tm

158 lines
4.6 KiB
Tcl

<TeXmacs|2.1.2>
<style|<tuple|beamer|no-page-numbers|chinese>>
<\body>
<\hide-preamble>
<assign|dfn|<macro|x|<strong|<arg|x>>>>
</hide-preamble>
<screens|<\shown>
<tit|\<#96F6\>\<#57FA\>\<#7840\>SICP\<#FF1A\>\<#7B2C\>3\<#8BFE\>>
<\wide-tabular>
<tformat|<cwith|2|-1|1|-1|cell-height|40px>|<cwith|2|-1|1|-1|cell-vmode|exact>|<table|<row|<\cell>
<very-large|<\sectional-normal-bold>
\<#7F16\>\<#7A0B\>\<#7684\>\<#57FA\>\<#672C\>\<#539F\>\<#7406\>
</sectional-normal-bold>>
</cell>|<\cell>
<very-large|<\sectional-normal-bold>
Elements of Programming
</sectional-normal-bold>>
</cell>>|<row|<\cell>
\<#8868\>\<#8FBE\>\<#5F0F\>
</cell>|<\cell>
Expressions
</cell>>|<row|<\cell>
\<#547D\>\<#540D\>\<#4E0E\>\<#73AF\>\<#5883\>
</cell>|<\cell>
Naming and the Evironment
</cell>>|<row|<\cell>
\<#7EC4\>\<#5408\>\<#5F0F\>\<#7684\>\<#6C42\>\<#503C\>
</cell>|<\cell>
Evaluating Combinations
</cell>>|<row|<\cell>
\<#590D\>\<#5408\>\<#51FD\>\<#6570\>
</cell>|<\cell>
Compound Procedures
</cell>>|<row|<\cell>
\<#51FD\>\<#6570\>\<#5E94\>\<#7528\>\<#7684\>\<#4EE3\>\<#6362\>\<#6A21\>\<#578B\>
</cell>|<\cell>
The Subsitution Model for Procedure Application
</cell>>|<row|<\cell>
\<#6761\>\<#4EF6\>\<#8868\>\<#8FBE\>\<#5F0F\>\<#548C\>\<#8C13\>\<#8BCD\>
</cell>|<\cell>
Conditional Expressions and Predicates
</cell>>|<row|<\cell>
\;
</cell>|<\cell>
\;
</cell>>|<row|<\cell>
\<#7EBF\>\<#6027\>\<#9012\>\<#5F52\>\<#548C\>\<#8FED\>\<#4EE3\>
</cell>|<\cell>
Linear Recursion and Iteration
</cell>>|<row|<\cell>
\<#6811\>\<#5F62\>\<#9012\>\<#5F52\>
</cell>|<\cell>
Tree Recursion
</cell>>>>
</wide-tabular>
</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>
<\initial>
<\collection>
<associate|info-flag|minimal>
<associate|marked-color|pastel yellow>
<associate|page-medium|beamer>
<associate|page-screen-margin|false>
<associate|par-columns|1>
<associate|preamble|false>
</collection>
</initial>
<\references>
<\collection>
<associate|auto-1|<tuple|1|?>>
</collection>
</references>