Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixing typos and glitches.

  • Loading branch information...
commit 2cb89535b7ac4e2cd3ab508a3c28e968de39ca18 1 parent 4ea6b4e
Hongwei Xi authored
View
6 Makefile_macosx
@@ -258,17 +258,17 @@ ATSLIB=$(ATSHOMEBIN)/atslib
.libfiles_local: .libfiles ; $(CC) -E -P -x c -o $@ $<
libfiles: .libfiles_local
- $(ATSLIB) $(ATS_PROOFCHECK) -O2 -D_XOPEN_SOURCE --libats
+ $(ATSLIB) $(ATS_PROOFCHECK) -O2 --libats
$(ATSLIB) $(ATS_PROOFCHECK) -O2 --libats_lex
$(ATSLIB) $(ATS_PROOFCHECK) -O2 --libats_smlbas
lib32files: .libfiles_local
- $(ATSLIB) $(ATS_PROOFCHECK) -m32 -O2 -D_XOPEN_SOURCE --libats
+ $(ATSLIB) $(ATS_PROOFCHECK) -m32 -O2 --libats
$(ATSLIB) $(ATS_PROOFCHECK) -m32 -O2 --libats_lex
$(ATSLIB) $(ATS_PROOFCHECK) -m32 -O2 --libats_smlbas
lib64files: .libfiles_local
- $(ATSLIB) $(ATS_PROOFCHECK) -m64 -O2 -D_XOPEN_SOURCE --libats
+ $(ATSLIB) $(ATS_PROOFCHECK) -m64 -O2 --libats
$(ATSLIB) $(ATS_PROOFCHECK) -m64 -O2 --libats_lex
$(ATSLIB) $(ATS_PROOFCHECK) -m64 -O2 --libats_smlbas
View
15 utils/atsdoc/DOCUMENT/TUTORIALATS/chap_mutailrec.atxt
@@ -38,18 +38,17 @@ Therefore, #code("isEvn") and #code("isOdd") are mutually tail-recursive.
#para("\
-In order to turn mutually recursive tail-calls into jumps, the
-bodies of the involved mutually recursive functions need to be
-combined. The keyword #code("fn*") in ATS is introduced for this
-purpose precisely. For instance, let us replace #code("fun") with
-#code("fn*") in the code above:
+In order to turn mutually recursive tail-calls into jumps, the bodies of
+the involved mutually recursive functions need to be combined. The keyword
+#code("fn*") in ATS is introduced precisely for this purpose. For instance,
+let us replace #code("fun") with #code("fn*") in the code above:
#atscode_extract("\
fn* isEvn (n: int): bool = if n > 0 then isOdd (n-1) else true
and isOdd (n: int): bool = if n > 0 then isEvn (n-1) else false
")
-Then the following C code is essentially generated from compiling
+Then the following C code is essentially what is generated from compiling
these two mutually defined functions:
#atscode("\
@@ -84,8 +83,8 @@ only if they all have the same return type. In the above case, both
#para("\
When translating C code involving embedded loops, we often encounter the
-need for mutual tail-recursion. For instance, the following C code prints
-out ordered pairs of digits:
+need for mutual tail-recursion. For example, the following C code prints
+out some ordered pairs of digits:
#atscode('\
int main (
View
12 utils/atsdoc/DOCUMENT/TUTORIALATS/chap_tailrec.atxt
@@ -21,7 +21,7 @@ in imperative programming are often implemented as tail-recursive functions.
#para('\
-Suppose that a function #emph("bar") calls another function #emph("bar"),
+Suppose that a function #emph("foo") calls another function #emph("bar"),
that is, there is a call to #emph("bar") appearing in the body of
#emph("foo"), where #emph("foo") and #emph("bar") may actually be the same
function. If the return value of the call to #emph("bar") also happens to be
@@ -60,7 +60,7 @@ stack space is adequate for executing each call to the function.
Let us now see some examples that can help further illustrate the notion of
tail-recursive call optimization. The following recursive function
#code("sum1") sums up all the natural numbers less than or equal to a given
-parameter #code("n"):
+integer parameter #code("n"):
")
@@ -70,9 +70,9 @@ fun sum1 (n: int): int = if n > 0 then n + sum1 (n-1) else 0
#para("\
-Clearly, #code("sum1") is not recursive as the only self call in its body
-is not a tail-call. The counterpart of #code("sum1") in C can essentially
-be given as follows:
+Clearly, #code("sum1") is not tail-recursive as the only self call in its
+body is not a tail-call. The counterpart of #code("sum1") in C can
+essentially be given as follows:
#atscode("\
int sum1 (int n) {
@@ -96,7 +96,7 @@ end // end of [sum2]
The inner function #code("loop") in the definition of #code("sum2") is
tail-recursive. The stack space consumed by #code("loop") is constant,
-that is, it is independent of the value of the argument of #code("sum2").
+that is, it is independent of the values of the arguments of #code("loop").
Essentially, the ATS compiler translates the definition of #code("sum2")
into the following C code:
Please sign in to comment.
Something went wrong with that request. Please try again.