about summary refs log tree commit diff stats
path: root/factorial.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-11-11 09:13:40 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-11-11 09:17:16 -0800
commit322416056beae917b0877f984ccc2b4b930a14ce (patch)
tree880be18d7769f519528591a03f2dc9e0903a4d91 /factorial.mu
parentb6a27fd257ac45dbddbd3e072e67e203b6b4ecee (diff)
downloadmu-322416056beae917b0877f984ccc2b4b930a14ce.tar.gz
2426
Diffstat (limited to 'factorial.mu')
-rw-r--r--factorial.mu7
1 files changed, 3 insertions, 4 deletions
diff --git a/factorial.mu b/factorial.mu
index 31b2f63c..02a4e2b0 100644
--- a/factorial.mu
+++ b/factorial.mu
@@ -7,9 +7,9 @@ recipe main [
 ]
 ]
 
-recipe factorial [
+recipe factorial n:number -> result:number [
   local-scope
-  n:number <- next-ingredient
+  load-ingredients
   {
     # if n=0 return 1
     zero?:boolean <- equal n, 0
@@ -19,8 +19,7 @@ recipe factorial [
   # return n * factorial(n-1)
   x:number <- subtract n, 1
   subresult:number <- factorial x
-  result:number <- multiply subresult, n
-  reply result
+  result <- multiply subresult, n
 ]
 
 # unit test