From bd2c74b88855aafb6a4685591eb4e401751edd60 Mon Sep 17 00:00:00 2001
From: Jim Pryor
Date: Thu, 25 Nov 2010 11:26:00 -0500
Subject: [PATCH] tweak calc improvements
Signed-off-by: Jim Pryor
---
advanced_topics/calculator_improvements.mdwn | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/advanced_topics/calculator_improvements.mdwn b/advanced_topics/calculator_improvements.mdwn
index 013b9a61..4ddff279 100644
--- a/advanced_topics/calculator_improvements.mdwn
+++ b/advanced_topics/calculator_improvements.mdwn
@@ -52,12 +52,12 @@ We'll add one boolean predicate, `Iszero`, and an `If...` construction.
We won't try here to catch any type errors, such as attempts to add a `bool` to an `int`, or attempts to check whether a `bool` iszero. Neither will we try here to monadize anything: these will be implementations of a calculator with all the plumbing exposed. What we will do is add more and more features to the calculator.
-We'll switch over to using variable `g` for assignment functions, which is a convention many of you seem familiar with. As we mentioned a few times in week 9, for some purposes it's easier to implement environment or assignment functions as functions from `char`s to `int`s (or whatever variables are bound to), rather than as lists as pairs. However, we'll stick with this implementation for now. We will however abstract out the type that the variables are bound to. For now, we'll suppose that they're bound to the same types that terms can express.
+We'll switch over to using variable `g` for assignment functions, which is a convention many of you seem familiar with. As we mentioned a few times in week 9, for some purposes it's easier to implement environment or assignment functions as functions from `char`s to `int`s (or whatever variables are bound to), rather than as lists of pairs. However, we'll stick with this implementation for now. We will however abstract out the type that the variables are bound to. For now, we'll suppose that they're bound to the same types that terms can express.
type bound_value = expressed_value;;
type assignment = (char * bound_value) list;;
-Here's where we should be now:
+Here's where we should be now. We expand some of the clauses in the `eval` function for clarity:
type term = Constant of int
| Multiplication of (term * term)
--
2.11.0