about summary refs log tree commit diff stats
path: root/html/075channel.mu.html
diff options
context:
space:
mode:
Diffstat (limited to 'html/075channel.mu.html')
-rw-r--r--html/075channel.mu.html16
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"> &lt;- </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:&amp;:source:char, buffered-out:&amp;:sink:char<span class="muRecipe"> -&gt; </span>buffered-out:&amp;:sink:char, in:&amp;: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:&amp;:source:char<span class="muRecipe"> -&gt; </span>result:text, source:&amp;:source:char [
+  <span class="Constant">local-scope</span>
+  <span class="Constant">load-ingredients</span>
+  buf:&amp;:buffer<span class="Special"> &lt;- </span>new-buffer <span class="Constant">30</span>
+  <span class="Delimiter">{</span>
+    c:char, done?:bool<span class="Special"> &lt;- </span>read source
+    <span class="muControl">break-if</span> done?
+    buf<span class="Special"> &lt;- </span>append buf, c
+    <span class="muControl">loop</span>
+  <span class="Delimiter">}</span>
+  result<span class="Special"> &lt;- </span>buffer-to-array buf
+]
 </pre>
 </body>
 </html>