about summary refs log tree commit diff stats
path: root/factorial.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-07-29 01:23:22 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-07-29 01:23:22 -0700
commitce87c19ee42bc52c5ab9a1ee3c431a9423e5a885 (patch)
tree126e2445997e1d5a35d80f2999744654dfe8e721 /factorial.mu
parentc91caafd5bd5dae25b0e0efa19879258ff61ad93 (diff)
downloadmu-ce87c19ee42bc52c5ab9a1ee3c431a9423e5a885.tar.gz
1880 - switch .mu files to new type-deducing idiom
Diffstat (limited to 'factorial.mu')
-rw-r--r--factorial.mu14
1 files changed, 7 insertions, 7 deletions
diff --git a/factorial.mu b/factorial.mu
index 23c247e0..31b2f63c 100644
--- a/factorial.mu
+++ b/factorial.mu
@@ -3,7 +3,7 @@
 recipe main [
   local-scope
   x:number <- factorial 5
-  $print [result: ], x:number, [ 
+  $print [result: ], x, [ 
 ]
 ]
 
@@ -12,15 +12,15 @@ recipe factorial [
   n:number <- next-ingredient
   {
     # if n=0 return 1
-    zero?:boolean <- equal n:number, 0
-    break-unless zero?:boolean
+    zero?:boolean <- equal n, 0
+    break-unless zero?
     reply 1
   }
   # return n * factorial(n-1)
-  x:number <- subtract n:number, 1
-  subresult:number <- factorial x:number
-  result:number <- multiply subresult:number, n:number
-  reply result:number
+  x:number <- subtract n, 1
+  subresult:number <- factorial x
+  result:number <- multiply subresult, n
+  reply result
 ]
 
 # unit test