# HG changeset patch # User Adam Chlipala # Date 1439133249 14400 # Node ID 544199d8b14aa0ce60de1fe1a0f2f0577a4d8473 # Parent a9dc205edd780cd1db3ed3afb19fd7ac31527eba Fix termination bug in tutorial's isEven/isOdd diff -r a9dc205edd78 -r 544199d8b14a doc/intro.ur --- 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. *)