diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-06-12 22:34:45 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-06-12 22:34:45 -0700 |
commit | d44123cabaa730c778a0e2644c75dbfba6a7ab30 (patch) | |
tree | a24e90f9fc864ea5b1c5e1f13433f55ad7acd30b /html/factorial.mu.html | |
parent | 1ae4e0d95f7e37dc7d0b146542fc39b4aed491de (diff) | |
download | mu-d44123cabaa730c778a0e2644c75dbfba6a7ab30.tar.gz |
1556
Diffstat (limited to 'html/factorial.mu.html')
-rw-r--r-- | html/factorial.mu.html | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/html/factorial.mu.html b/html/factorial.mu.html index c57d4b62..22438340 100644 --- a/html/factorial.mu.html +++ b/html/factorial.mu.html @@ -13,13 +13,13 @@ pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background-color: #080808; } body { font-family: monospace; color: #eeeeee; background-color: #080808; } * { font-size: 1em; } +.muScenario { color: #00af00; } .Delimiter { color: #c000c0; } .Comment { color: #8080ff; } .Constant { color: #008080; } .Special { color: #ff6060; } -.Identifier { color: #008080; } +.muControl { color: #804000; } .muRecipe { color: #ff8700; } -.muScenario { color: #00af00; } --> </style> @@ -34,26 +34,26 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <span class="Comment"># example program: compute the factorial of 5</span> <span class="muRecipe">recipe</span> main [ - <span class="Identifier">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> x:number<span class="Special"> <- </span>factorial <span class="Constant">5:literal</span> - <span class="Identifier"> $print</span> <span class="Constant">[result: ]</span>, x:number, <span class="Constant">[ </span> + $print <span class="Constant">[result: ]</span>, x:number, <span class="Constant">[ </span> <span class="Constant">]</span> ] <span class="muRecipe">recipe</span> factorial [ - <span class="Identifier">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> - n:number<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> + <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + n:number<span class="Special"> <- </span><span class="Constant">next-ingredient</span> <span class="Delimiter">{</span> <span class="Comment"># if n=0 return 1</span> zero?:boolean<span class="Special"> <- </span>equal n:number, <span class="Constant">0:literal</span> - <span class="Identifier">break-unless</span> zero?:boolean - <span class="Identifier">reply</span> <span class="Constant">1:literal</span> + <span class="muControl">break-unless</span> zero?:boolean + <span class="muControl">reply</span> <span class="Constant">1:literal</span> <span class="Delimiter">}</span> <span class="Comment"># return n * factorial(n - 1)</span> x:number<span class="Special"> <- </span>subtract n:number, <span class="Constant">1:literal</span> subresult:number<span class="Special"> <- </span>factorial x:number result:number<span class="Special"> <- </span>multiply subresult:number, n:number - <span class="Identifier">reply</span> result:number + <span class="muControl">reply</span> result:number ] <span class="Comment"># unit test</span> |