Commit 80ce8e28 authored by POTTIER Francois's avatar POTTIER Francois

Include processed code for omap.

Split double in its own figure.
parent 2b375d51
......@@ -3,6 +3,7 @@
\usepackage[utf8]{inputenc}
\usepackage[bookmarks=true,bookmarksopen=true,colorlinks=true,%
linkcolor=blue,citecolor=blue,urlcolor=blue]{hyperref}
% \usepackage{marginnote}
\usepackage{listings}
\input{listings-ocaml}
\lstset{language=ocaml}
......@@ -373,7 +374,9 @@ is found.
\begin{figure}[p]
\orig{expr12}
\caption{An open type of arithmetic expressions}
\vspace{-\baselineskip}
\processed{expr12}
\caption{An open type of arithmetic expressions} % and a visitor for it
\label{fig:expr12}
\end{figure}
......@@ -391,10 +394,17 @@ is found.
\label{fig:expr08}
\end{figure}
\begin{figure}[p]
\codefollowupgeneral{Figures~\ref{fig:expr12} and \ref{fig:expr13}}
\origfirstline{expr13double}{4}
\caption{A transformation of arithmetic expressions}
\label{fig:expr13double}
\end{figure}
\begin{figure}[p]
\codefollowupgeneral{Figures~\ref{fig:expr12}, \ref{fig:expr13}, and~\ref{fig:expr08}}
\origfirstline{expr14}{6}
\caption{Conversions between two closed types of arithmetic expressions}
\caption{Conversions between two types of arithmetic expressions}
\label{fig:expr14}
\end{figure}
......
......@@ -8,10 +8,3 @@ class ['self] map = object (self : 'self)
method visit_'expr env (E e) =
E (self#visit_oexpr env e)
end
let double (e : expr) : expr =
let v = object
inherit [_] map
method! visit_EConst _env k = EConst (2 * k)
end in
v # visit_'expr () e
open Expr12
open Expr13
let double (e : expr) : expr =
let v = object
inherit [_] map
method! visit_EConst _env k = EConst (2 * k)
end in
v # visit_'expr () e
open Expr12
open Expr13
open Expr13double
let const k = E (EConst k)
let add e1 e2 = E (EAdd (e1, e2))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment