diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-06-20 10:18:03 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-06-20 10:18:03 -0700 |
commit | 130596f0e0efe89a4bee136c1d62ecc577c756e2 (patch) | |
tree | e9962528054941bd9d0ece0c52014c891395e30d /075channel.mu | |
parent | 359586f0ee29f46f33decd33d0c55b8e4f052053 (diff) | |
download | mu-130596f0e0efe89a4bee136c1d62ecc577c756e2.tar.gz |
3933
Diffstat (limited to '075channel.mu')
-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 |