about summary refs log tree commit diff stats
path: root/cpp/factorial.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-05-05 19:47:34 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-05-05 19:47:34 -0700
commit4caa718f6b28871acc858cb9e5de7e0c4a7cba0f (patch)
tree7c146b9d0288bd8deb076a393f750ef1cd845044 /cpp/factorial.mu
parent9b7e00e79b0b68d704005ab1e149be53c4154b20 (diff)
downloadmu-4caa718f6b28871acc858cb9e5de7e0c4a7cba0f.tar.gz
1272
Diffstat (limited to 'cpp/factorial.mu')
-rw-r--r--cpp/factorial.mu20
1 files changed, 11 insertions, 9 deletions
diff --git a/cpp/factorial.mu b/cpp/factorial.mu
index 08d8afee..0921a7e9 100644
--- a/cpp/factorial.mu
+++ b/cpp/factorial.mu
@@ -1,3 +1,13 @@
+# example program: compute the factorial of 7
+
+recipe main [
+  default-space:address:space <- new location:type, 30:literal
+  x:integer <- factorial 7:literal
+  $print x:integer
+  $print [
+]
+]
+
 recipe factorial [
   default-space:address:array:location <- new location:type, 30:literal
   n:integer <- next-ingredient
@@ -14,16 +24,8 @@ recipe factorial [
   reply result:integer
 ]
 
-recipe main [
-  default-space:address:space <- new location:type, 30:literal
-  x:integer <- factorial 7:literal
-  $print x:integer
-  $print [
-]
-]
-
+# unit test
 scenario factorial-test [
-#?   dump all #? 1
   run [
     1:integer <- factorial 5:literal
   ]