summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2015-08-09 11:14:09 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2015-08-09 11:14:09 -0400
commita2c0e1d4f4acce227f2d75d3203cd7263608c749 (patch)
treec433988277b9cb26438def61a42e0196abbeb001 /doc
parent6775186a7e6bfcadcef841d4c0578494dde331cd (diff)
Fix termination bug in tutorial's isEven/isOdd
Diffstat (limited to 'doc')
-rw-r--r--doc/intro.ur7
1 files changed, 5 insertions, 2 deletions
diff --git a/doc/intro.ur b/doc/intro.ur
index 770b7b06..b08e2395 100644
--- a/doc/intro.ur
+++ b/doc/intro.ur
@@ -58,12 +58,15 @@ fun fact n = if n = 0 then 1 else n * fact (n - 1)
fact 5
(* end *)
-fun isEven n = n = 0 || isOdd (n - 1)
-and isOdd n = n = 1 || isEven (n - 1)
+fun isEven n = n = 0 || (n > 1 && isOdd (n - 1))
+and isOdd n = n = 1 || (n > 1 && isEven (n - 1))
(* begin eval *)
isEven 32
(* end *)
+(* begin eval *)
+isEven 31
+(* end *)
(* Of course we have anonymous functions, too. *)