From ce87c19ee42bc52c5ab9a1ee3c431a9423e5a885 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 29 Jul 2015 01:23:22 -0700 Subject: 1880 - switch .mu files to new type-deducing idiom --- channel.mu | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'channel.mu') diff --git a/channel.mu b/channel.mu index eb5b9641..ffa6d9f6 100644 --- a/channel.mu +++ b/channel.mu @@ -7,13 +7,13 @@ recipe producer [ # n = 0 n:number <- copy 0 { - done?:boolean <- lesser-than n:number, 5 - break-unless done?:boolean + done?:boolean <- lesser-than n, 5 + break-unless done? # other threads might get between these prints - $print [produce: ], n:number, [ + $print [produce: ], n, [ ] - chan:address:channel <- write chan:address:channel, n:number - n:number <- add n:number, 1 + chan:address:channel <- write chan, n + n <- add n, 1 loop } ] @@ -24,7 +24,7 @@ recipe consumer [ chan:address:channel <- next-ingredient { # read an integer from the channel - n:number, chan:address:channel <- read chan:address:channel + n:number, chan:address:channel <- read chan # other threads might get between these prints $print [consume: ], n:number, [ ] @@ -36,8 +36,8 @@ recipe main [ local-scope chan:address:channel <- new-channel 3 # create two background 'routines' that communicate by a channel - routine1:number <- start-running producer:recipe, chan:address:channel - routine2:number <- start-running consumer:recipe, chan:address:channel - wait-for-routine routine1:number - wait-for-routine routine2:number + routine1:number <- start-running producer:recipe, chan + routine2:number <- start-running consumer:recipe, chan + wait-for-routine routine1 + wait-for-routine routine2 ] -- cgit 1.4.1-2-gfad0