diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-11-16 23:39:46 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-11-16 23:39:46 -0800 |
commit | 6e455985c745d976f2c185ff6fa6f9b59280e1a7 (patch) | |
tree | bddcc690c3b546499a15e519dccb77d91060090e | |
parent | 1437d8417a4ab70646bafa41f64214f4c931300f (diff) | |
download | mu-6e455985c745d976f2c185ff6fa6f9b59280e1a7.tar.gz |
4123
-rw-r--r-- | continuation1.mu | 16 | ||||
-rw-r--r-- | html/continuation1.mu.html | 38 |
2 files changed, 18 insertions, 36 deletions
diff --git a/continuation1.mu b/continuation1.mu index 11811c1d..8e9b1d03 100644 --- a/continuation1.mu +++ b/continuation1.mu @@ -4,25 +4,17 @@ # # Expected output: # 1 -# 2 -# 3 def main [ local-scope k:continuation <- call-with-continuation-mark create-yielder - { - x:num, done?:bool <- call k # should return 1 - break-if done? - $print x 10/newline - loop - } + x:num <- call k # should return 1 + $print x 10/newline ] -def create-yielder -> n:num, done?:bool [ +def create-yielder -> n:num [ local-scope load-ingredients - n <- copy 0 return-continuation-until-mark - done?:bool <- greater-or-equal n, 3 - n <- add n, 1 + return 1 ] diff --git a/html/continuation1.mu.html b/html/continuation1.mu.html index 0588b688..65db879f 100644 --- a/html/continuation1.mu.html +++ b/html/continuation1.mu.html @@ -17,8 +17,6 @@ a:hover { text-decoration: underline; } * { font-size: 12pt; font-size: 1em; } .muRecipe { color: #ff8700; } .Special { color: #c00000; } -.Conceal { color: #4e4e4e; } -.Delimiter { color: #800080; } .Comment { color: #9090ff; } .Comment a { color:#0000ee; text-decoration:underline; } .Constant { color: #00a0a0; } @@ -64,28 +62,20 @@ if ('onhashchange' in window) { <span id="L4" class="LineNr"> 4 </span><span class="Comment">#</span> <span id="L5" class="LineNr"> 5 </span><span class="Comment"># Expected output:</span> <span id="L6" class="LineNr"> 6 </span><span class="Comment"># 1</span> -<span id="L7" class="LineNr"> 7 </span><span class="Comment"># 2</span> -<span id="L8" class="LineNr"> 8 </span><span class="Comment"># 3</span> -<span id="L9" class="LineNr"> 9 </span> -<span id="L10" class="LineNr">10 </span><span class="muRecipe">def</span> <a href='continuation1.mu.html#L10'>main</a> [ -<span id="L11" class="LineNr">11 </span> <span class="Constant">local-scope</span> -<span id="L12" class="LineNr">12 </span> k:continuation <span class="Special"><-</span> call-with-continuation-mark <a href='continuation1.mu.html#L21'>create-yielder</a> -<span id="L13" class="LineNr">13 </span> <span class="Delimiter">{</span> -<span id="L14" class="LineNr">14 </span> <span class="Conceal">¦</span> x:num, done?:bool <span class="Special"><-</span> call k <span class="Comment"># should return 1</span> -<span id="L15" class="LineNr">15 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> done? -<span id="L16" class="LineNr">16 </span> <span class="Conceal">¦</span> $print x <span class="Constant">10/newline</span> -<span id="L17" class="LineNr">17 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> -<span id="L18" class="LineNr">18 </span> <span class="Delimiter">}</span> -<span id="L19" class="LineNr">19 </span>] -<span id="L20" class="LineNr">20 </span> -<span id="L21" class="LineNr">21 </span><span class="muRecipe">def</span> <a href='continuation1.mu.html#L21'>create-yielder</a><span class="muRecipe"> -> </span>n:num, done?:bool [ -<span id="L22" class="LineNr">22 </span> <span class="Constant">local-scope</span> -<span id="L23" class="LineNr">23 </span> <span class="Constant">load-ingredients</span> -<span id="L24" class="LineNr">24 </span> n <span class="Special"><-</span> copy<span class="Constant"> 0</span> -<span id="L25" class="LineNr">25 </span> return-continuation-until-mark -<span id="L26" class="LineNr">26 </span> done?:bool <span class="Special"><-</span> greater-or-equal n,<span class="Constant"> 3</span> -<span id="L27" class="LineNr">27 </span> n <span class="Special"><-</span> add n,<span class="Constant"> 1</span> -<span id="L28" class="LineNr">28 </span>] +<span id="L7" class="LineNr"> 7 </span> +<span id="L8" class="LineNr"> 8 </span><span class="muRecipe">def</span> <a href='continuation1.mu.html#L8'>main</a> [ +<span id="L9" class="LineNr"> 9 </span> <span class="Constant">local-scope</span> +<span id="L10" class="LineNr">10 </span> k:continuation <span class="Special"><-</span> call-with-continuation-mark <a href='continuation1.mu.html#L15'>create-yielder</a> +<span id="L11" class="LineNr">11 </span> x:num <span class="Special"><-</span> call k <span class="Comment"># should return 1</span> +<span id="L12" class="LineNr">12 </span> $print x <span class="Constant">10/newline</span> +<span id="L13" class="LineNr">13 </span>] +<span id="L14" class="LineNr">14 </span> +<span id="L15" class="LineNr">15 </span><span class="muRecipe">def</span> <a href='continuation1.mu.html#L15'>create-yielder</a><span class="muRecipe"> -> </span>n:num [ +<span id="L16" class="LineNr">16 </span> <span class="Constant">local-scope</span> +<span id="L17" class="LineNr">17 </span> <span class="Constant">load-ingredients</span> +<span id="L18" class="LineNr">18 </span> return-continuation-until-mark +<span id="L19" class="LineNr">19 </span> <span class="muControl">return</span><span class="Constant"> 1</span> +<span id="L20" class="LineNr">20 </span>] </pre> </body> </html> |