-
Notifications
You must be signed in to change notification settings - Fork 1
/
derive.tex
42 lines (33 loc) · 1.39 KB
/
derive.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
\section{Derived expression types}
\label{derivedsection}
This section gives rewrite rules for the derived expression types. By
the application of these rules, any expression can be reduced to a
semantically equivalent expression in which only the primitive
expression types (literal, variable, call, \ide{lambda}, \ide{if}) occur.
\newcommand{\iet}{\hbox to 2em{\hfil $\equiv$}} % is equivalent to
\begin{schemenoindent}
(cond (\hyper{test} \hyper{expression})
\hyperii{clause} \dotsfoo)
\iet (if \hyper{test}
(\hyper{expression})
(cond \hyperii{clause} \dotsfoo))
(cond (else \hyper{expression}))
\iet (\hyper{expression})
(cond)
\iet \hyper{some expression returning an unspecified value}
\end{schemenoindent}
\begin{schemenoindent}
(and) \=\iet \schtrue
(and \hyper{test})\>\iet \hyper{test}
(and \hyperi{test} \hyperii{test} \dotsfoo)
\iet (if \hyperi{test} (and \hyperii{test} \dotsfoo) \schfalse{})
(or) \>\iet \schfalse
(or \hyper{test})\>\iet \hyper{test}
(or \hyperi{test} \hyperii{test} \dotsfoo)
\iet (if \hyperi{test} \hyperi{test} (or \hyperii{test} \dotsfoo))
(let ((\hyperi{variable} \hyperi{init}) \dotsfoo)
\hyper{body})
\iet ((lambda (\hyperi{variable} \dotsfoo) \hyper{body}) \hyperi{init} \dotsfoo)
\end{schemenoindent}
%Since expressions have no side effects, the value of test1 in the expansion
%for "or" only needs to be calculated once.