diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-10-22 04:04:46 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-10-22 04:04:46 -0700 |
commit | beea7ce25cfe42c363259705a6b5741ad47484ab (patch) | |
tree | d30b44a935bad1cb6c88083c57caabdf062ed513 /html/075channel.mu.html | |
parent | 98e3a41bf96b37d94f6b0a0e98a4635a174e9903 (diff) | |
download | mu-beea7ce25cfe42c363259705a6b5741ad47484ab.tar.gz |
3543
Diffstat (limited to 'html/075channel.mu.html')
-rw-r--r-- | html/075channel.mu.html | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/html/075channel.mu.html b/html/075channel.mu.html index 862329f8..eda9e8da 100644 --- a/html/075channel.mu.html +++ b/html/075channel.mu.html @@ -412,7 +412,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color result<span class="Special"> <- </span>length *q ] -<span class="Comment"># helper for channels of characters in particular</span> +<span class="SalientComment">## helpers for channels of characters in particular</span> + <span class="muRecipe">def</span> buffer-lines in:&:source:char, buffered-out:&:sink:char<span class="muRecipe"> -> </span>buffered-out:&:sink:char, in:&:source:char [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> @@ -511,6 +512,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color test: reached end ] ] + +<span class="muRecipe">def</span> drain source:&:source:char<span class="muRecipe"> -> </span>result:text, source:&:source:char [ + <span class="Constant">local-scope</span> + <span class="Constant">load-ingredients</span> + buf:&:buffer<span class="Special"> <- </span>new-buffer <span class="Constant">30</span> + <span class="Delimiter">{</span> + c:char, done?:bool<span class="Special"> <- </span>read source + <span class="muControl">break-if</span> done? + buf<span class="Special"> <- </span>append buf, c + <span class="muControl">loop</span> + <span class="Delimiter">}</span> + result<span class="Special"> <- </span>buffer-to-array buf +] </pre> </body> </html> |