progs/fun/fun.sc
changeset 1035 c479d6ef57f8
parent 1031 b62c0002c735
--- a/progs/fun/fun.sc	Thu Nov 27 18:18:36 2025 +0000
+++ b/progs/fun/fun.sc	Thu Dec 04 21:33:25 2025 +0000
@@ -1,3 +1,13 @@
+def even(n: Int) : Boolean = {
+  if (n == 0) true else odd(n - 1) 
+}
+def odd(n: Int) : Boolean = {
+  if (n == 0) false else even(n - 1) 
+}
+
+
+
+
 // A Small Compiler for a Simple Functional Language
 // (includes a parser and lexer)
 //
@@ -16,9 +26,7 @@
 //    amm fun.sc run fact.fun   
 //
 // the first prints out the JVM instructions for two
-// factorial functions
-//
-// the next compile/run fun files
+// factorial functions; the next compiles/runs fun files
 //
 
 import $file.fun_tokens, fun_tokens._