diff options
-rw-r--r-- | 075channel.mu | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/075channel.mu b/075channel.mu index d9a252fd..72fa0a6c 100644 --- a/075channel.mu +++ b/075channel.mu @@ -160,18 +160,6 @@ def read in:&:source:_elem -> result:_elem, eof?:bool, in:&:source:_elem [ # todo: create a notion of iterator and iterable so we can read/write whole # aggregates (arrays, lists, ..) of _elems at once. -def clear in:&:source:_elem -> in:&:source:_elem [ - local-scope - load-ingredients - chan:&:channel:_elem <- get *in, chan:offset - { - empty?:bool <- channel-empty? chan - break-if empty? - _, _, in <- read in - loop - } -] - scenario channel-initialization [ run [ local-scope @@ -321,6 +309,18 @@ scenario channel-clear [ ] ] +def clear in:&:source:_elem -> in:&:source:_elem [ + local-scope + load-ingredients + chan:&:channel:_elem <- get *in, chan:offset + { + empty?:bool <- channel-empty? chan + break-if empty? + _, _, in <- read in + loop + } +] + ## cancelling channels # every channel comes with a boolean signifying if it's been closed |