diff doc/intro.ur @ 2168:544199d8b14a

Fix termination bug in tutorial's isEven/isOdd
author Adam Chlipala <adam@chlipala.net>
date Sun, 09 Aug 2015 11:14:09 -0400
parents 2d9f831d45c9
children
line wrap: on
line diff
--- a/doc/intro.ur	Thu Aug 06 12:51:09 2015 -0400
+++ b/doc/intro.ur	Sun Aug 09 11:14:09 2015 -0400
@@ -58,12 +58,15 @@
 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. *)