diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-09-17 15:01:51 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-09-17 15:01:51 -0700 |
commit | f344b250f6f062a1a1902bf69b23ebf9b565de0e (patch) | |
tree | 199bd32a9aee198d5028b1c21b83d2cf0944b2b6 /html/factorial.mu.html | |
parent | 897ae8c1855f830d8819759ea327d147f28a09bf (diff) | |
download | mu-f344b250f6f062a1a1902bf69b23ebf9b565de0e.tar.gz |
3395
Diffstat (limited to 'html/factorial.mu.html')
-rw-r--r-- | html/factorial.mu.html | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/html/factorial.mu.html b/html/factorial.mu.html index 370fa8e0..ccd47c99 100644 --- a/html/factorial.mu.html +++ b/html/factorial.mu.html @@ -35,12 +35,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muRecipe">def</span> main [ <span class="Constant">local-scope</span> - x:number<span class="Special"> <- </span>factorial <span class="Constant">5</span> + x:num<span class="Special"> <- </span>factorial <span class="Constant">5</span> $print <span class="Constant">[result: ]</span>, x, <span class="Constant">[ </span> <span class="Constant">]</span> ] -<span class="muRecipe">def</span> factorial n:number<span class="muRecipe"> -> </span>result:number [ +<span class="muRecipe">def</span> factorial n:num<span class="muRecipe"> -> </span>result:num [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="Delimiter">{</span> @@ -50,15 +50,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muControl">return</span> <span class="Constant">1</span> <span class="Delimiter">}</span> <span class="Comment"># return n * factorial(n-1)</span> - x:number<span class="Special"> <- </span>subtract n, <span class="Constant">1</span> - subresult:number<span class="Special"> <- </span>factorial x + x:num<span class="Special"> <- </span>subtract n, <span class="Constant">1</span> + subresult:num<span class="Special"> <- </span>factorial x result<span class="Special"> <- </span>multiply subresult, n ] <span class="Comment"># unit test</span> <span class="muScenario">scenario</span> factorial-test [ run [ - <span class="Constant">1</span>:number<span class="Special"> <- </span>factorial <span class="Constant">5</span> + <span class="Constant">1</span>:num<span class="Special"> <- </span>factorial <span class="Constant">5</span> ] memory-should-contain [ <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">120</span> |