diff options
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> |