From 08c7fbdb0b5c65884b3443ef3bd4de71fb2c4c1e Mon Sep 17 00:00:00 2001 From: Jim Whitescarver Date: Mon, 29 Jul 2019 11:14:26 -0400 Subject: [PATCH 1/8] Update peek.rho syntax implemented is different than planned. --- 04-PersistentSendAndPeek/peek.rho | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/04-PersistentSendAndPeek/peek.rho b/04-PersistentSendAndPeek/peek.rho index bef9a1f..5cab725 100644 --- a/04-PersistentSendAndPeek/peek.rho +++ b/04-PersistentSendAndPeek/peek.rho @@ -1,4 +1,3 @@ -// REMINDER: Peek is not yet implemented new airportInfo, stdout(`rho:io:stdout`) in { // ATC sends the info @@ -6,7 +5,7 @@ new airportInfo, stdout(`rho:io:stdout`) in { | // Pilot receives the info - for (info Date: Mon, 29 Jul 2019 11:20:55 -0400 Subject: [PATCH 2/8] update peek syntax --- 04-PersistentSendAndPeek/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/04-PersistentSendAndPeek/README.md b/04-PersistentSendAndPeek/README.md index cbb1424..48613b9 100644 --- a/04-PersistentSendAndPeek/README.md +++ b/04-PersistentSendAndPeek/README.md @@ -55,13 +55,13 @@ One problem with the code above is that a forgetful pilot may not actually put t ![Peeking at a message allows you to read it without consuming it.](letterPeek.png) -Rholang will have a special syntax for this sort of thing eventually. It isn't available right now, but I'll show you the syntax just so you're ready. To "peek" at what's on a channel without consuming it, use the ` Date: Thu, 29 Oct 2020 13:15:06 -0400 Subject: [PATCH 3/8] change stdout to result for explore deploy --- 01-SendingAndStandardOut/README.md | 16 ++++++++-------- 01-SendingAndStandardOut/hello.rho | 4 ++-- 01-SendingAndStandardOut/parallel.rho | 4 ++-- 02-Receiving/README.md | 2 +- 02-Receiving/coffeeShop.rho | 4 ++-- 02-Receiving/persistentPizzaShop.rho | 4 ++-- 02-Receiving/pizzaOrder.rho | 4 ++-- 03-TelephoneNamesAndProcesses/README.md | 8 ++++---- 03-TelephoneNamesAndProcesses/telephone3.rho | 4 ++-- 04-PersistentSendAndPeek/README.md | 2 +- 04-PersistentSendAndPeek/grandmaCheck.rho | 6 +++--- 04-PersistentSendAndPeek/peek.rho | 4 ++-- 04-PersistentSendAndPeek/persistentSend.rho | 4 ++-- 04-PersistentSendAndPeek/putBack.rho | 4 ++-- 04-PersistentSendAndPeek/putBackAnswer.rho | 4 ++-- 05-JoinOperator/README.md | 2 +- 05-JoinOperator/launch.rho | 4 ++-- 05-JoinOperator/launchBad.rho | 4 ++-- 05-JoinOperator/patienceSolution.rho | 6 +++--- 06-UnforgeableNamesAndAcks/README.md | 14 +++++++------- 06-UnforgeableNamesAndAcks/bound1.rho | 2 +- 06-UnforgeableNamesAndAcks/bound2.rho | 2 +- 06-UnforgeableNamesAndAcks/newPizzaShop.rho | 4 ++-- 06-UnforgeableNamesAndAcks/pizzaAck.rho | 4 ++-- 06-UnforgeableNamesAndAcks/stdoutAck.rho | 9 ++++----- 07-BundlesAndInterpolation/README.md | 6 +++--- 07-BundlesAndInterpolation/fanmailAsk.rho | 6 +++--- 07-BundlesAndInterpolation/fanmailBad.rho | 4 ++-- 07-BundlesAndInterpolation/fanmailEve.rho | 2 +- 07-BundlesAndInterpolation/fanmailPublish.rho | 6 +++--- 07-BundlesAndInterpolation/interpolation.rho | 4 ++-- .../jackPotNicePrinting.rho | 4 ++-- 07-BundlesAndInterpolation/jackpot.rho | 6 +++--- 07-BundlesAndInterpolation/jackpotPublish.rho | 4 ++-- 08-StateChannelsAndMethods/box.rho | 4 ++-- 08-StateChannelsAndMethods/counter.rho | 4 ++-- 08-StateChannelsAndMethods/counterFactory.rho | 2 +- 08-StateChannelsAndMethods/counterTests.rho | 8 ++++---- 08-StateChannelsAndMethods/patience.rho | 6 +++--- 09-ObjectCapabilities/atc.rho | 4 ++-- 10-MoreSyntax/README.md | 10 +++++----- 10-MoreSyntax/greeter.rho | 8 ++++---- 10-MoreSyntax/math.rho | 8 +++----- 10-MoreSyntax/signTest.rho | 6 +++--- 11-PatternMatching/README.md | 2 +- 11-PatternMatching/greeter2.rho | 8 +++----- 11-PatternMatching/intersection.rho | 2 +- 11-PatternMatching/matching.rho | 12 ++++++------ 11-PatternMatching/missileSafe.rho | 2 +- 11-PatternMatching/missileUnsafe.rho | 2 +- 11-PatternMatching/sendASend.rho | 10 +++++----- 11-PatternMatching/union.rho | 2 +- 12-DataStructures/README.md | 4 ++-- 12-DataStructures/capitalOf.rho | 2 +- 12-DataStructures/list.rho | 10 +++++----- 12-DataStructures/map.rho | 2 +- 12-DataStructures/set.rho | 18 +++++++++--------- 12-DataStructures/tuple.rho | 2 +- 12-DataStructures/wordLength.rho | 8 ++++---- 15-GoingOffChain/insertArbitrary.rho | 8 ++++---- 15-GoingOffChain/lookup.rho | 9 ++++----- converter/package-lock.json | 6 +++--- converter/package.json | 2 +- 63 files changed, 166 insertions(+), 172 deletions(-) diff --git a/01-SendingAndStandardOut/README.md b/01-SendingAndStandardOut/README.md index 87d8be6..09481a7 100644 --- a/01-SendingAndStandardOut/README.md +++ b/01-SendingAndStandardOut/README.md @@ -13,7 +13,7 @@ There is a long-standing tradition in programming that your first program should Make the program print "Rholang rocks!" instead of "Hello World". -## WTH is stdout? +## WTH is result? ![Channels are like mailboxes for sending messages](mailbox.png) @@ -21,14 +21,14 @@ The heart of rholang is communicating on channels. Channels are communication li ![Redo this diagram!](sendSyntax.png) -We created the channel `stdout` on the first line of the program with `new stdout`. You'll create lots of channels as you learn rholang. We also gave our channel a special power by including `(rho:io:stdout)`. More on that later, but for now just know that you need that part in parentheses to make text actually appear on the screen. +We created the channel `result` on the first line of the program with `new result`. You'll create lots of channels as you learn rholang. We also gave our channel a special power by including `(rho:io:result)`. More on that later, but for now just know that you need that part in parentheses to make text actually appear on the screen. ## Using other channels ![Sent messages wait to be received here in "message purgatory"... JK, it's called the "tuplespace"](mailboxes.png) -You can actually send messages on lots of channels, not just `stdout`. But unlike `stdout` they won't display on the screen because we won't add any special powers to them. +You can actually send messages on lots of channels, not just `result`. But unlike `result` they won't display on the screen because we won't add any special powers to them. [tupleSpace.rho](tupleSpace.rho) @@ -66,9 +66,9 @@ Print two messages, "Rick" and "Morty", on the screen in one program. ## Quiz -What will `stdout!("Programming!")` print to the screen? +What will `result!("Programming!")` print to the screen? - [x] Programming! -- [ ] stdout! +- [ ] result! - [ ] Nothing @@ -76,14 +76,14 @@ What channel does `what!("Up")` send a message on? - [ ] `Up` - [x] `what` - [ ] `what` -- [ ] `stdout` +- [ ] `result` Which does rholang do first in ``` -stdout!("Dogs") +result!("Dogs") | -stdout!("Cats") +result!("Cats") ``` - [ ] prints "Dogs" - [ ] prints "Cats" diff --git a/01-SendingAndStandardOut/hello.rho b/01-SendingAndStandardOut/hello.rho index f0afa39..abb32c7 100644 --- a/01-SendingAndStandardOut/hello.rho +++ b/01-SendingAndStandardOut/hello.rho @@ -1,3 +1,3 @@ -new stdout(`rho:io:stdout`) in { - stdout!("Hello World!") +new result in { + result!("Hello World!") } diff --git a/01-SendingAndStandardOut/parallel.rho b/01-SendingAndStandardOut/parallel.rho index 1217bf1..d2d971c 100644 --- a/01-SendingAndStandardOut/parallel.rho +++ b/01-SendingAndStandardOut/parallel.rho @@ -1,5 +1,5 @@ -new chan1, stdout(`rho:io:stdout`) in { - stdout!("I'm on the screen") +new result, chan1 in { + result!("I'm on the screen") | chan1!("I'm in the tuplespace") } diff --git a/02-Receiving/README.md b/02-Receiving/README.md index 8362988..9a25de2 100644 --- a/02-Receiving/README.md +++ b/02-Receiving/README.md @@ -19,7 +19,7 @@ BTW, lines that start with `//` are called comments. They're just there for huma ![Pizza shop can receive messages on its channel.](pizza.png) -The following code sends a message on a channel for a pizza shop and the pizza shop receives it. The pizza shop acknowledges receiving the message by printing to `stdout`. +The following code sends a message on a channel for a pizza shop and the pizza shop receives it. The pizza shop acknowledges receiving the message by printing to `result`. [pizzaOrder](pizzaOrder.rho) diff --git a/02-Receiving/coffeeShop.rho b/02-Receiving/coffeeShop.rho index 22dacf9..7425f3c 100644 --- a/02-Receiving/coffeeShop.rho +++ b/02-Receiving/coffeeShop.rho @@ -1,6 +1,6 @@ -new coffeeShop, stdout(`rho:io:stdout`) in { +new result, coffeeShop in { contract coffeeShop(order) = { - stdout!("Coffee Order Received") + result!("Coffee Order Received") } | coffeeShop!("one hot chocolate") diff --git a/02-Receiving/persistentPizzaShop.rho b/02-Receiving/persistentPizzaShop.rho index 707c252..a89e6e4 100644 --- a/02-Receiving/persistentPizzaShop.rho +++ b/02-Receiving/persistentPizzaShop.rho @@ -1,6 +1,6 @@ -new pizzaShop, stdout(`rho:io:stdout`) in { +new result, pizzaShop in { for (order <= pizzaShop) { - stdout!("Pizza Order Received") + result!("Pizza Order Received") } | pizzaShop!("one hot chocolate") diff --git a/02-Receiving/pizzaOrder.rho b/02-Receiving/pizzaOrder.rho index b6a554a..ff81fbd 100644 --- a/02-Receiving/pizzaOrder.rho +++ b/02-Receiving/pizzaOrder.rho @@ -1,7 +1,7 @@ -new pizzaShop, stdout(`rho:io:stdout`) in { +new result, pizzaShop in { pizzaShop!("2 medium pies") | for(order <- pizzaShop){ - stdout!("Order Received.") + result!("Order Received.") } } diff --git a/03-TelephoneNamesAndProcesses/README.md b/03-TelephoneNamesAndProcesses/README.md index 724ce5d..3aa21f0 100644 --- a/03-TelephoneNamesAndProcesses/README.md +++ b/03-TelephoneNamesAndProcesses/README.md @@ -16,7 +16,7 @@ As the message says, you learn most when you experiment. So be sure to change th ### Exercise -That telephone game was fun, but it's always better the have more players. Go ahead and add a third player called Charlie. Instead of printing to `stdout`, bob will send the message along to Charlie. Then Charlie will print it to the screen. The More the Merrier! +That telephone game was fun, but it's always better the have more players. Go ahead and add a third player called Charlie. Instead of printing to `result`, bob will send the message along to Charlie. Then Charlie will print it to the screen. The More the Merrier! @@ -38,7 +38,7 @@ Did you notice the `*` in `bob!(*message)`? In rholang there are two kinds of th A "process" is any piece of rholang code such as our telephone game, or our pizza shop order program. Processes can be big hundred-line programs or small on-liners. They can even be tiny pieces of code that are just values. Here are some example processes. - - `stdout!("Sup Rholang?")` A common send + - `result!("Sup Rholang?")` A common send - `Nil` The smallest possible process. It literally means "do nothing". - `for(msg <- phone){Nil}` A common receive that does nothing when a message arrives. - `"Hello World"` Another small process that also does nothing. These are called "Ground Terms". @@ -121,7 +121,7 @@ What is `@@Nil`? - [ ] `@"BobsPhone"` - [ ] `*"BobsPhone"` - [ ] `@*"BobsPhone"` -- [ ] `stdout!("BobsPhone")` +- [ ] `result!("BobsPhone")` @@ -131,4 +131,4 @@ What is `@@Nil`? Instead of a linear telephone game where each player passes the message to the next, let's add a branch in the game. So now Bob will send to Charlie like before, but Bob will also send to Dawn. -Each branch can be as long as you want, but at the end of each branch, print the message to `stdout`. +Each branch can be as long as you want, but at the end of each branch, print the message to `result`. diff --git a/03-TelephoneNamesAndProcesses/telephone3.rho b/03-TelephoneNamesAndProcesses/telephone3.rho index 56f9584..6c10363 100644 --- a/03-TelephoneNamesAndProcesses/telephone3.rho +++ b/03-TelephoneNamesAndProcesses/telephone3.rho @@ -1,4 +1,4 @@ -new alice, bob, stdout(`rho:io:stdout`) in { +new result, alice, bob, result in { // Start the game by sending a message to Alice alice!("How to program: Change stuff and see what happens.") | @@ -14,6 +14,6 @@ new alice, bob, stdout(`rho:io:stdout`) in { // Concurrently, Bob will listens for the message for (message <- bob) { // Bob is the last player, so he'll announce the message - stdout!(*message) + result!(*message) } } diff --git a/04-PersistentSendAndPeek/README.md b/04-PersistentSendAndPeek/README.md index 48613b9..dd99bf8 100644 --- a/04-PersistentSendAndPeek/README.md +++ b/04-PersistentSendAndPeek/README.md @@ -21,7 +21,7 @@ Confirm for yourself that the original send is still in the tuplespace. ### Exercise Modify the above code so that a second pilot also receives the information. Still, the send persists. -By the way, did you notice that we don't need `new stdout(...) in {}` when we don't actually print anything to the screen `stdout`? +By the way, did you notice that we don't need `new result(...) in {}` when we don't actually print anything to the screen `result`? How many comm events happen in `for (x <- y) {Nil} | y!!(Nil)` - [x] `1` diff --git a/04-PersistentSendAndPeek/grandmaCheck.rho b/04-PersistentSendAndPeek/grandmaCheck.rho index 2aa7b5a..01b7169 100644 --- a/04-PersistentSendAndPeek/grandmaCheck.rho +++ b/04-PersistentSendAndPeek/grandmaCheck.rho @@ -1,10 +1,10 @@ -new grandma, stdout(`rho:io:stdout`) in { +new result, grandma, result in { // I send the message grandma!("Meet at the mall at 4:00") | // I double check the message for (msg <- grandma){ - stdout!("Double checking the message") + result!("Double checking the message") | // Put a copy back on the channel for grandma grandma!(*msg) @@ -12,6 +12,6 @@ new grandma, stdout(`rho:io:stdout`) in { | // Grandma receives it for (msg <- grandma){ - stdout!("I got your message") + result!("I got your message") } } diff --git a/04-PersistentSendAndPeek/peek.rho b/04-PersistentSendAndPeek/peek.rho index 5cab725..683ff1e 100644 --- a/04-PersistentSendAndPeek/peek.rho +++ b/04-PersistentSendAndPeek/peek.rho @@ -1,12 +1,12 @@ -new airportInfo, stdout(`rho:io:stdout`) in { +new result, airportInfo, result in { // ATC sends the info airportInfo!("No wind; Runway 11") | // Pilot receives the info for (info <<- airportInfo) { - stdout!(*info) + result!(*info) } | diff --git a/04-PersistentSendAndPeek/persistentSend.rho b/04-PersistentSendAndPeek/persistentSend.rho index abb3bd6..685b0a8 100644 --- a/04-PersistentSendAndPeek/persistentSend.rho +++ b/04-PersistentSendAndPeek/persistentSend.rho @@ -1,9 +1,9 @@ -new airportInfo, stdout(`rho:io:stdout`) in { +new result, airportInfo, result in { // ATC sends the info airportInfo!!("No wind; Runway 11") | // Pilot receives the info for (info <- airportInfo) { - stdout!(*info) + result!(*info) } } diff --git a/04-PersistentSendAndPeek/putBack.rho b/04-PersistentSendAndPeek/putBack.rho index beab146..38cc5e0 100644 --- a/04-PersistentSendAndPeek/putBack.rho +++ b/04-PersistentSendAndPeek/putBack.rho @@ -1,11 +1,11 @@ -new airportInfo, stdout(`rho:io:stdout`) in { +new result, airportInfo, result in { // ATC sends the info airportInfo!("No wind; Runway 11") | // Pilot receives the info for (info <- airportInfo) { - stdout!(*info) + result!(*info) // TODO Pilot MUST put the info back } | diff --git a/04-PersistentSendAndPeek/putBackAnswer.rho b/04-PersistentSendAndPeek/putBackAnswer.rho index fb878ac..57554ee 100644 --- a/04-PersistentSendAndPeek/putBackAnswer.rho +++ b/04-PersistentSendAndPeek/putBackAnswer.rho @@ -1,11 +1,11 @@ -new airportInfo, stdout(`rho:io:stdout`) in { +new result, airportInfo, result in { // ATC sends the info airportInfo!("No wind; Runway 11") | // Pilot receives the info for (info <- airportInfo) { - stdout!(*info) | + result!(*info) | airportInfo!(*info) // Putting the message back for other pilots } | diff --git a/05-JoinOperator/README.md b/05-JoinOperator/README.md index 8bb89c6..acfaa62 100644 --- a/05-JoinOperator/README.md +++ b/05-JoinOperator/README.md @@ -10,7 +10,7 @@ Rholang has the join operator for exactly this situation. To perform a join, jus ``` for (p1Pushups <- player1; p2Pushups <- player2) { - stdout!("The winner is...") + result!("The winner is...") } ``` diff --git a/05-JoinOperator/launch.rho b/05-JoinOperator/launch.rho index b7b6fcc..4cc4bdc 100644 --- a/05-JoinOperator/launch.rho +++ b/05-JoinOperator/launch.rho @@ -1,7 +1,7 @@ -new aliceLaunch, bobLaunch, stdout(`rho:io:stdout`) in { +new result, aliceLaunch, bobLaunch, result in { // Listen for both launch commands for (x <- aliceLaunch; y <- bobLaunch){ - stdout!("Launching the rocket") + result!("Launching the rocket") } | // When ready, Engineers send their commands diff --git a/05-JoinOperator/launchBad.rho b/05-JoinOperator/launchBad.rho index cb1910a..42dbd7b 100644 --- a/05-JoinOperator/launchBad.rho +++ b/05-JoinOperator/launchBad.rho @@ -1,11 +1,11 @@ // REMINDER: This is the BAD way to solve the problem. -new aliceLaunch, bobLaunch, stdout(`rho:io:stdout`) in { +new result, aliceLaunch, bobLaunch, result in { // Listen for Alice's then Bob's launch commands for (x <- aliceLaunch){ for (y <- bobLaunch){ - stdout!("Launching the rocket") + result!("Launching the rocket") } } | diff --git a/05-JoinOperator/patienceSolution.rho b/05-JoinOperator/patienceSolution.rho index ecd9ff7..edbe6ee 100644 --- a/05-JoinOperator/patienceSolution.rho +++ b/05-JoinOperator/patienceSolution.rho @@ -1,4 +1,4 @@ -new p1, p2, stdout(`rho:io:stdout`) in { +new result, p1, p2, result in { // Send messages like in both orders p1!("Send any message") | p2!("Hope I win") | @@ -6,7 +6,7 @@ new p1, p2, stdout(`rho:io:stdout`) in { // When Player one wins for (m2 <- p2){ for (m1 <- p1){ - stdout!("Player one wins!") + result!("Player one wins!") } } | @@ -14,7 +14,7 @@ new p1, p2, stdout(`rho:io:stdout`) in { // When player two wins for (m1 <- p1){ for (m2 <- p2){ - stdout!("Player two wins!") + result!("Player two wins!") } } } diff --git a/06-UnforgeableNamesAndAcks/README.md b/06-UnforgeableNamesAndAcks/README.md index 0b81216..4d5164e 100644 --- a/06-UnforgeableNamesAndAcks/README.md +++ b/06-UnforgeableNamesAndAcks/README.md @@ -58,7 +58,7 @@ What happens when you try to order a pizza from outside of the `new` restriction - [x] Error about top-level free variables - [ ] The code runs, but no order is received -We learned that all names quote processes. So what process does the `pizzaShop` name quote? Try printing the process to `stdout` to see +We learned that all names quote processes. So what process does the `pizzaShop` name quote? Try printing the process to `result` to see - [ ] It quotes "pizzaShop" - [ ] It doesn't quote anything - [x] "Some Unforgeable hex code" @@ -86,7 +86,7 @@ To do that the pizza shop needs to know how to contact the customer. So the cust Why don't the acknowledgements in the previous example show up on the screen? - [ ] There is a bug in the code - [ ] The orders were not received correctly -- [x] The confirmation was not sent to `stdout` +- [x] The confirmation was not sent to `result` @@ -104,17 +104,17 @@ Bob also wants to order a pizza and give a unforgeable ack channel. Where should - [ ] On the same line Alice did - [ ] On the very first line of the program -## `stdoutAck` and `stderrAck` +## `resultAck` and `stderrAck` -Now that you understand ack channels, you should know about two other ways to print to the screen. They are channels called `stdoutAck` and `stderrAck`. They work just like their cousins from lesson 1, but they take an ack channel. +Now that you understand ack channels, you should know about two other ways to print to the screen. They are channels called `resultAck` and `stderrAck`. They work just like their cousins from lesson 1, but they take an ack channel. -[stdoutAck.rho](stdoutAck.rho) +[resultAck.rho](resultAck.rho) By the way, did you ever notice the handful of stuff that always starts in a fresh tuplespace? Four of those things are the built-in receives for the screen-printing channels. The others are for cryptography. We'll discuss them later. ### Exercise -`stdout!("1") | stdout!("2") | stdout!("3")` +`result!("1") | result!("2") | result!("3")` Notice that this program does not print the numbers in any particular order. The calls happen concurrently. Imagine we really need these lines to print in order. Modify the code to use ack channels and ensure that the numbers get printed in order. ### Exercise @@ -124,7 +124,7 @@ new myChan in { myChan!("Hi There") } | -for (msg <- myChan) {stdout!(*msg)} +for (msg <- myChan) {result!(*msg)} ``` If your prediction for the previous exercise was wrong, modify the program so it actually does what you predicted it would. diff --git a/06-UnforgeableNamesAndAcks/bound1.rho b/06-UnforgeableNamesAndAcks/bound1.rho index 9832a58..a01e548 100644 --- a/06-UnforgeableNamesAndAcks/bound1.rho +++ b/06-UnforgeableNamesAndAcks/bound1.rho @@ -1,3 +1,3 @@ for (order <= coffeeShop) { - stdout!("Coffee Order Received") + result!("Coffee Order Received") } diff --git a/06-UnforgeableNamesAndAcks/bound2.rho b/06-UnforgeableNamesAndAcks/bound2.rho index 4b74e3a..8b5f163 100644 --- a/06-UnforgeableNamesAndAcks/bound2.rho +++ b/06-UnforgeableNamesAndAcks/bound2.rho @@ -1,3 +1,3 @@ contract coffeeShop(order) = { - stdout!("Coffee Order Received") + result!("Coffee Order Received") } diff --git a/06-UnforgeableNamesAndAcks/newPizzaShop.rho b/06-UnforgeableNamesAndAcks/newPizzaShop.rho index 869f6fc..483eebb 100644 --- a/06-UnforgeableNamesAndAcks/newPizzaShop.rho +++ b/06-UnforgeableNamesAndAcks/newPizzaShop.rho @@ -1,8 +1,8 @@ -new pizzaShop, stdout(`rho:io:stdout`) in { +new result, pizzaShop, result in { // Same contract as before contract pizzaShop(order) = { - stdout!("Order Received.") + result!("Order Received.") } | // Known customers can order because pizzaShop is bound here. diff --git a/06-UnforgeableNamesAndAcks/pizzaAck.rho b/06-UnforgeableNamesAndAcks/pizzaAck.rho index 37dfdc4..25b6cbb 100644 --- a/06-UnforgeableNamesAndAcks/pizzaAck.rho +++ b/06-UnforgeableNamesAndAcks/pizzaAck.rho @@ -1,8 +1,8 @@ -new alice, bob, pizzaShop in { +new result, alice, bob, pizzaShop in { // Now we take an order and an ack channel contract pizzaShop(order, ack) = { - // Instead of acknowledging via stdout, we use ack + // Instead of acknowledging via result, we use ack ack!("Order Received.") } | diff --git a/06-UnforgeableNamesAndAcks/stdoutAck.rho b/06-UnforgeableNamesAndAcks/stdoutAck.rho index 411dfa3..a1af4a4 100644 --- a/06-UnforgeableNamesAndAcks/stdoutAck.rho +++ b/06-UnforgeableNamesAndAcks/stdoutAck.rho @@ -1,10 +1,9 @@ -new myAckChannel, - stdout(`rho:io:stdout`), - stdoutAck(`rho:io:stdoutAck`) in { +new result, myAckChannel, + resultAck(`rho:io:stdoutAck`) in { - stdoutAck!("Print some words.", *myAckChannel) + resultAck!("Print some words.", *myAckChannel) | for (acknowledgement <- myAckChannel) { - stdout!("Received an acknowledgement.") + result!("Received an acknowledgement.") } } diff --git a/07-BundlesAndInterpolation/README.md b/07-BundlesAndInterpolation/README.md index 25fb69c..bae7da0 100644 --- a/07-BundlesAndInterpolation/README.md +++ b/07-BundlesAndInterpolation/README.md @@ -57,7 +57,7 @@ Who will catch the ball in the jackpot code? ### Exercise -Exercise: Use stdoutAck to display how many points each person actually gets when they catch the ball. +Exercise: Use resultAck to display how many points each person actually gets when they catch the ball. @@ -70,9 +70,9 @@ How is this game in rholang different than the real game where one ball is throw ## Side Bar: String Operations -Most programming languages will allow you to join or "concatenate" two strings together, and rholang is no exception. We can `stdout!("Hello " ++ "world")`, but we can't concatenate a string with an int. +Most programming languages will allow you to join or "concatenate" two strings together, and rholang is no exception. We can `result!("Hello " ++ "world")`, but we can't concatenate a string with an int. -One solution is to use `stdoutAck` andsend acknowledgements. Another option is to print a list `stdout!(["Bill caught it. Points earned: ", *points])`. We'll go into more detail about both techniques in future lessons. +One solution is to use `resultAck` andsend acknowledgements. Another option is to print a list `result!(["Bill caught it. Points earned: ", *points])`. We'll go into more detail about both techniques in future lessons. A final option is to use string interpolation. String interpolation allows you to put placeholders into your strings and replace them with actual values using a map. diff --git a/07-BundlesAndInterpolation/fanmailAsk.rho b/07-BundlesAndInterpolation/fanmailAsk.rho index fc5a90f..9903a95 100644 --- a/07-BundlesAndInterpolation/fanmailAsk.rho +++ b/07-BundlesAndInterpolation/fanmailAsk.rho @@ -1,4 +1,4 @@ -new alice, bob, eve, stdout(`rho:io:stdout`) in { +new result, alice, bob, eve, result in { // Alice get a lot of fan mail, so she // creates a new write only bundle and publishes it. @@ -12,7 +12,7 @@ new alice, bob, eve, stdout(`rho:io:stdout`) in { // Alice also reads fan mail for (mail <- aliceFanMail) { - stdout!("Alice received a fanmail") + result!("Alice received a fanmail") } } | @@ -33,7 +33,7 @@ new alice, bob, eve, stdout(`rho:io:stdout`) in { alice!(*return) | for (aliceFanMail <- return) { for (@stolenMail <= aliceFanMail) { - stdout!(["Eve stole a message: ", stolenMail]) + result!(["Eve stole a message: ", stolenMail]) } } } diff --git a/07-BundlesAndInterpolation/fanmailBad.rho b/07-BundlesAndInterpolation/fanmailBad.rho index 180bff7..43e74bb 100644 --- a/07-BundlesAndInterpolation/fanmailBad.rho +++ b/07-BundlesAndInterpolation/fanmailBad.rho @@ -1,7 +1,7 @@ -new alice, stdout(`rho:io:stdout`) in { +new result, alice, result in { // Alice reads fan mail for (mail <- alice) { - stdout!("Alice received a fanmail") + result!("Alice received a fanmail") } | diff --git a/07-BundlesAndInterpolation/fanmailEve.rho b/07-BundlesAndInterpolation/fanmailEve.rho index 6d5ff55..9333d7c 100644 --- a/07-BundlesAndInterpolation/fanmailEve.rho +++ b/07-BundlesAndInterpolation/fanmailEve.rho @@ -1,3 +1,3 @@ for (@stolenMail <= alice) { - stdout!("Eve stole a message") + result!("Eve stole a message") } diff --git a/07-BundlesAndInterpolation/fanmailPublish.rho b/07-BundlesAndInterpolation/fanmailPublish.rho index 933090f..5678864 100644 --- a/07-BundlesAndInterpolation/fanmailPublish.rho +++ b/07-BundlesAndInterpolation/fanmailPublish.rho @@ -1,4 +1,4 @@ -new alice, bob, eve, stdout(`rho:io:stdout`) in { +new result, alice, bob, eve, result in { // Alice gets a lot of fan mail, so she // creates a new write only bundle and publishes it. @@ -10,7 +10,7 @@ new alice, bob, eve, stdout(`rho:io:stdout`) in { // Alice also reads fan mail for (mail <= aliceFanMail) { - stdout!("Alice received a fanmail") + result!("Alice received a fanmail") } } | @@ -26,7 +26,7 @@ new alice, bob, eve, stdout(`rho:io:stdout`) in { // because Alice's fanmail channel is write-only for (aliceFanMail <- alice) { for (@stolenMail <= aliceFanMail) { - stdout!(["Eve stole a message: ", stolenMail]) + result!(["Eve stole a message: ", stolenMail]) } } } diff --git a/07-BundlesAndInterpolation/interpolation.rho b/07-BundlesAndInterpolation/interpolation.rho index 65b4ff2..a7d542a 100644 --- a/07-BundlesAndInterpolation/interpolation.rho +++ b/07-BundlesAndInterpolation/interpolation.rho @@ -1,8 +1,8 @@ -new stdout(`rho:io:stdout`) in { +new result in { printStuff!({"noun": person, "adverb": sideways}) | contract printStuff(map) = { - stdout!("The ${noun} jumped ${adverb}" %% *map) + result!("The ${noun} jumped ${adverb}" %% *map) } } diff --git a/07-BundlesAndInterpolation/jackPotNicePrinting.rho b/07-BundlesAndInterpolation/jackPotNicePrinting.rho index 4d2ccab..00a372a 100644 --- a/07-BundlesAndInterpolation/jackPotNicePrinting.rho +++ b/07-BundlesAndInterpolation/jackPotNicePrinting.rho @@ -1,9 +1,9 @@ for (points <= @throw){ new ack in { - stdoutAck!("Bill caught it. Points earned: ", *ack) + resultAck!("Bill caught it. Points earned: ", *ack) | for( _ <- ack){ - stdout!(*points) + result!(*points) } } } diff --git a/07-BundlesAndInterpolation/jackpot.rho b/07-BundlesAndInterpolation/jackpot.rho index cf0023f..a8b5e52 100644 --- a/07-BundlesAndInterpolation/jackpot.rho +++ b/07-BundlesAndInterpolation/jackpot.rho @@ -1,4 +1,4 @@ -new throw, stdout(`rho:io:stdout`) in { +new result, throw, result in { // Throw the ball worth five points throw!(5) | @@ -10,10 +10,10 @@ new throw, stdout(`rho:io:stdout`) in { // Bill and Paige both try to catch for (points <= throw){ - stdout!("Bill caught it") + result!("Bill caught it") } | for (points <= throw){ - stdout!("Paige caught it") + result!("Paige caught it") } } diff --git a/07-BundlesAndInterpolation/jackpotPublish.rho b/07-BundlesAndInterpolation/jackpotPublish.rho index a240893..c3e9dce 100644 --- a/07-BundlesAndInterpolation/jackpotPublish.rho +++ b/07-BundlesAndInterpolation/jackpotPublish.rho @@ -1,4 +1,4 @@ -new gameCh, stdout(`rho:io:stdout`) in { +new result, gameCh, result in { new throw in { //Give out read-only access @@ -13,7 +13,7 @@ new gameCh, stdout(`rho:io:stdout`) in { // Bill and Paige join the game for (throw <- gameCh){ for (points <= throw){ - stdout!(["Bill caught it. Points: ", *points]) + result!(["Bill caught it. Points: ", *points]) } } | diff --git a/08-StateChannelsAndMethods/box.rho b/08-StateChannelsAndMethods/box.rho index c6321db..a68f972 100644 --- a/08-StateChannelsAndMethods/box.rho +++ b/08-StateChannelsAndMethods/box.rho @@ -1,4 +1,4 @@ -new stdout(`rho:io:stdout`), boxCh in { +new result, boxCh in { // To save data we just put it in the box boxCh!(42) | @@ -6,6 +6,6 @@ new stdout(`rho:io:stdout`), boxCh in { // Then to get data back out for (data <- boxCh) { // Do whatever you want with the data here. - stdout!(*data) + result!(*data) } } diff --git a/08-StateChannelsAndMethods/counter.rho b/08-StateChannelsAndMethods/counter.rho index c08a379..6b344bc 100644 --- a/08-StateChannelsAndMethods/counter.rho +++ b/08-StateChannelsAndMethods/counter.rho @@ -1,4 +1,4 @@ -new currentCount, increase, reset, check, stdout(`rho:io:stdout`) in { +new result, currentCount, increase, reset, check, result in { // Starting the counter at 0 currentCount!(0) | @@ -32,7 +32,7 @@ new currentCount, increase, reset, check, stdout(`rho:io:stdout`) in { // And check it's value afterwards for(_ <- ack; count <- currentCount) { - stdout!(*count) + result!(*count) } } } diff --git a/08-StateChannelsAndMethods/counterFactory.rho b/08-StateChannelsAndMethods/counterFactory.rho index c34414e..5944eb0 100644 --- a/08-StateChannelsAndMethods/counterFactory.rho +++ b/08-StateChannelsAndMethods/counterFactory.rho @@ -1,4 +1,4 @@ -new counterFactory, stdout(`rho:io:stdout`) in { +new result, counterFactory, result in { contract counterFactory(increase, reset) = { new currentCount in { // Start the counter at zero diff --git a/08-StateChannelsAndMethods/counterTests.rho b/08-StateChannelsAndMethods/counterTests.rho index b21fb60..f9e9d2d 100644 --- a/08-StateChannelsAndMethods/counterTests.rho +++ b/08-StateChannelsAndMethods/counterTests.rho @@ -1,20 +1,20 @@ -new ack in { +new result, ack in { // This gets deeply nested because it's sequential. // This indentation style keeps it readable increase!(*ack) | for(_ <- ack) { check!(*ack) | for(count <- ack) { - stdoutAck!(*count, *ack) | for(_ <- ack) { + resultAck!(*count, *ack) | for(_ <- ack) { increase!(*ack) | for(_ <- ack) { check!(*ack) | for(count <- ack) { - stdoutAck!(*count, *ack) | for(_ <- ack) { + resultAck!(*count, *ack) | for(_ <- ack) { reset!(*ack) | for(count <- ack) { check!(*ack) | for(count <- ack) { - stdout!(*count) + result!(*count) }}}}}}}} } diff --git a/08-StateChannelsAndMethods/patience.rho b/08-StateChannelsAndMethods/patience.rho index 408c407..0cfd1eb 100644 --- a/08-StateChannelsAndMethods/patience.rho +++ b/08-StateChannelsAndMethods/patience.rho @@ -1,4 +1,4 @@ -new P1, P2, stdout(`rho:io:stdout`) in { +new result, P1, P2, result in { // active gets its own scope so players can't change its value. new active in { @@ -6,13 +6,13 @@ new P1, P2, stdout(`rho:io:stdout`) in { | for(_ <- active; _ <- P1) { for( _ <- P2) { - stdout!("P2 Wins") + result!("P2 Wins") } } | for(_ <- active; _ <- P2) { for (_ <- P1) { - stdout!("P1 Wins") + result!("P1 Wins") } } } diff --git a/09-ObjectCapabilities/atc.rho b/09-ObjectCapabilities/atc.rho index 531fc99..3f72904 100644 --- a/09-ObjectCapabilities/atc.rho +++ b/09-ObjectCapabilities/atc.rho @@ -1,5 +1,5 @@ -new stationFactory, stdout(`rho:io:stdout`) in { +new result, stationFactory, result in { contract stationFactory(initialMessage, getInfo, setInfo) = { new currentMessage in { // Populate the initial message @@ -33,5 +33,5 @@ new stationFactory, stdout(`rho:io:stdout`) in { } | // Listener tunes in to receive latest message - airportInfo!(*stdout) + airportInfo!(*result) } diff --git a/10-MoreSyntax/README.md b/10-MoreSyntax/README.md index 1e04876..e08bd2c 100644 --- a/10-MoreSyntax/README.md +++ b/10-MoreSyntax/README.md @@ -14,7 +14,7 @@ The final binary operator you should know is `++` which is used for "concatenati [greeter.rho](greeter.rho) -What would the code `stdout!("I" ++ "<3" ++ "rholang")` output? +What would the code `result!("I" ++ "<3" ++ "rholang")` output? - [ ] I <3 rholang - [ ] ["I", "<3", "rholang"] - [x] I<3rholang @@ -47,7 +47,7 @@ What code could be parred with the previous code to leave the number `24` on `do ### Exercise Revisit the telephone game from lesson 3 and show that we could have used the `@message` pattern so `message` would be a process. -What should replace the ... in `for(@x <- @y){stdout!(...)}` to make the program valid? +What should replace the ... in `for(@x <- @y){result!(...)}` to make the program valid? - [ ] `@x` - [x] `x` - [ ] `*x` @@ -101,17 +101,17 @@ Rholang also has the classic Boolean operators AND, OR, and NOT. The syntax is * `a or b` true when either `a` or `b` is true * `not a` true when `a` is false -What would `stdout!(true and true)` output? +What would `result!(true and true)` output? - [x] true - [ ] false - [ ] neither; that's invalid syntax -What would `stdout!(not true)` output? +What would `result!(not true)` output? - [ ] true - [x] false - [ ] neither; that's invalid syntax -What would `stdout!((not not true) or false)` output? +What would `result!((not not true) or false)` output? - [x] true - [ ] false - [ ] neither; that's invalid syntax diff --git a/10-MoreSyntax/greeter.rho b/10-MoreSyntax/greeter.rho index 8ed7f36..264f90d 100644 --- a/10-MoreSyntax/greeter.rho +++ b/10-MoreSyntax/greeter.rho @@ -1,10 +1,10 @@ -new greeter in { +new result, greeter in { contract greeter(name, return) = { return!("Hello there, " ++ *name) } | - new stdout(`rho:io:stdout`) in { - greeter!("Joshy", *stdout)| - greeter!("Tom", *stdout) + new result in { + greeter!("Joshy", *result)| + greeter!("Tom", *result) } } diff --git a/10-MoreSyntax/math.rho b/10-MoreSyntax/math.rho index aa9adf2..226d397 100644 --- a/10-MoreSyntax/math.rho +++ b/10-MoreSyntax/math.rho @@ -1,4 +1,4 @@ -new c2f, f2c in { +new result, c2f, f2c in { /** * Converts Celcius temperatures to Farenheit. The conversion @@ -14,11 +14,9 @@ new c2f, f2c in { } | - new stdout(`rho:io:stdout`) in { // 0 C should be 32 F - c2f!(0, *stdout) + c2f!(0, *result) | // 100 C should be 212 F - c2f!(100, *stdout) - } + c2f!(100, *result) } diff --git a/10-MoreSyntax/signTest.rho b/10-MoreSyntax/signTest.rho index c4902be..6c03e40 100644 --- a/10-MoreSyntax/signTest.rho +++ b/10-MoreSyntax/signTest.rho @@ -1,9 +1,9 @@ -new stdout(`rho:io:stdout`) in { +new result in { for (@balance <= @"signTest") { if (balance > 0) { - stdout!("Account in good standing.") + result!("Account in good standing.") } else { - stdout!("Account overdrawn.") + result!("Account overdrawn.") } } } diff --git a/11-PatternMatching/README.md b/11-PatternMatching/README.md index 1f7d6c3..0da7f92 100644 --- a/11-PatternMatching/README.md +++ b/11-PatternMatching/README.md @@ -93,7 +93,7 @@ To match both of two patterns you use the "intersection" operator, `/\`. In this [intersection.rho](intersection.rho) -Notice I called my stdout channel `print` that time. You can call those names anything you'd like. Although it's generally good to be consistent so as not to confuse anyone. From here on I'll stick with `stdout`. +Notice I called my result channel `print` that time. You can call those names anything you'd like. Although it's generally good to be consistent so as not to confuse anyone. From here on I'll stick with `result`. ### Exercise The union example here is pretty basic. Expand it so it can match more languages and more words. Also write tests that show what happens when only the default pattern is matched. diff --git a/11-PatternMatching/greeter2.rho b/11-PatternMatching/greeter2.rho index 5c514f5..4b81d17 100644 --- a/11-PatternMatching/greeter2.rho +++ b/11-PatternMatching/greeter2.rho @@ -1,5 +1,5 @@ -new greeter in { +new result, greeter in { contract greeter(name, return) = { return!("Hello there, " ++ *name) } @@ -9,8 +9,6 @@ new greeter in { return!("Hello there, world") } | - new stdout(`rho:io:stdout`) in { - greeter!("Joshy", *stdout)| - greeter!("Tom", *stdout) - } + greeter!("Joshy", *result)| + greeter!("Tom", *result) } diff --git a/11-PatternMatching/intersection.rho b/11-PatternMatching/intersection.rho index 80daaee..c6ebf9b 100644 --- a/11-PatternMatching/intersection.rho +++ b/11-PatternMatching/intersection.rho @@ -1,4 +1,4 @@ -new print(`rho:io:stdout`), register in { +new print, register in { for (@{{@"name"!(_) | _} /\ {@"age"!(_) | _}} <= register){ print!("Both name and age were in the data") diff --git a/11-PatternMatching/matching.rho b/11-PatternMatching/matching.rho index 4d54959..42eab78 100644 --- a/11-PatternMatching/matching.rho +++ b/11-PatternMatching/matching.rho @@ -1,12 +1,12 @@ -new patternMatcher, stdout(`rho:io:stdout`) in { +new result, patternMatcher, result in { for (x <= patternMatcher) { match *x { - Nil => stdout!("Got the stopped process") - "hello" => stdout!("Got the string hello") - [x, y] => stdout!("Got a two-element list") - Int => stdout!("Got an integer") - _ => stdout!("Got something else") + Nil => result!("Got the stopped process") + "hello" => result!("Got the string hello") + [x, y] => result!("Got a two-element list") + Int => result!("Got an integer") + _ => result!("Got something else") } } | diff --git a/11-PatternMatching/missileSafe.rho b/11-PatternMatching/missileSafe.rho index a9d2553..2321d81 100644 --- a/11-PatternMatching/missileSafe.rho +++ b/11-PatternMatching/missileSafe.rho @@ -1,4 +1,4 @@ -new getInspectionChannel, log(`rho:io:stdout`), missile in { +new log, getInspectionChannel, missile in { contract @(*missile, "launch")(_) = { log!("launching...") diff --git a/11-PatternMatching/missileUnsafe.rho b/11-PatternMatching/missileUnsafe.rho index 4d44bc5..d583e64 100644 --- a/11-PatternMatching/missileUnsafe.rho +++ b/11-PatternMatching/missileUnsafe.rho @@ -1,4 +1,4 @@ -new log(`rho:io:stdout`), missile in { +new log, missile in { contract @(*missile, "launch")(_) = { log!("launching...") diff --git a/11-PatternMatching/sendASend.rho b/11-PatternMatching/sendASend.rho index e348d59..5cb45ac 100644 --- a/11-PatternMatching/sendASend.rho +++ b/11-PatternMatching/sendASend.rho @@ -1,11 +1,11 @@ -new patternMatcher, stdout(`rho:io:stdout`) in { +new result, patternMatcher, result in { for (x <= patternMatcher) { match *x { - Nil => stdout!("Got the stopped process") - {_!(_)} => stdout!("Got a send") - {for(@0 <- _){_}} => stdout!("Got a receive on @0") - _ => stdout!("Got something else") + Nil => result!("Got the stopped process") + {_!(_)} => result!("Got a send") + {for(@0 <- _){_}} => result!("Got a receive on @0") + _ => result!("Got something else") } } | diff --git a/11-PatternMatching/union.rho b/11-PatternMatching/union.rho index 7b289cb..8dde628 100644 --- a/11-PatternMatching/union.rho +++ b/11-PatternMatching/union.rho @@ -1,4 +1,4 @@ -new log(`rho:io:stdout`), binderChecker in { +new log, binderChecker in { contract binderChecker(@data, return) = { match data { "nombre" \/ "name" => return!("name-like") diff --git a/12-DataStructures/README.md b/12-DataStructures/README.md index da96aa2..bf6738d 100644 --- a/12-DataStructures/README.md +++ b/12-DataStructures/README.md @@ -144,13 +144,13 @@ We've learned about several interesting data structures in this lesson. Data str In this example, Alice and Bob each have one unforgeable name (that I've called key). The keys may be useful on their own (for things not shown in the snippet), but only when used together, can the contract shown be called. This is known as "rights amplification". ``` -new alice, bob, key1, key2, stdout(`rho:io:stdout`) in { +new alice, bob, key1, key2, result(`rho:io:result`) in { alice!(*key1)| bob!(*key2)| contract @(*key1, *key2)(_) = { - stdout!("Congratulations, Alice and Bob, you've cooperated.") + result!("Congratulations, Alice and Bob, you've cooperated.") } } ``` diff --git a/12-DataStructures/capitalOf.rho b/12-DataStructures/capitalOf.rho index 94ffb5b..817c448 100644 --- a/12-DataStructures/capitalOf.rho +++ b/12-DataStructures/capitalOf.rho @@ -1,4 +1,4 @@ -new capitalOf, print(`rho:io:stdout`) in { +new print, capitalOf in { new mapCh in { // Use a persistent send instead of peeking later diff --git a/12-DataStructures/list.rho b/12-DataStructures/list.rho index 8def1ad..9157f9c 100644 --- a/12-DataStructures/list.rho +++ b/12-DataStructures/list.rho @@ -1,28 +1,28 @@ -new lCh, stdout(`rho:io:stdout`) in { +new result, lCh, result in { // Make a new list, l lCh!!([3, 4, 5])| // Test nth for (@l <- lCh){ - stdout!("Test nth. Expected: 5. Got: ${ans}" %% {"ans": l.nth(2)}) + result!("Test nth. Expected: 5. Got: ${ans}" %% {"ans": l.nth(2)}) } | // Test toByteArray for (@l <- lCh){ - stdout!(["Test toByteArray. Got: ", l.toByteArray()]) + result!(["Test toByteArray. Got: ", l.toByteArray()]) } | // Test slice for (@l <- lCh){ - stdout!(["Test slice. Expected: [4, 5]. Got: ", l.slice(1, 3)]) + result!(["Test slice. Expected: [4, 5]. Got: ", l.slice(1, 3)]) } | // Test length for (@l <- lCh){ - stdout!("Test length. Expected: 3. Got: '${ans}" %% {"ans": l.length()}) + result!("Test length. Expected: 3. Got: '${ans}" %% {"ans": l.length()}) } } diff --git a/12-DataStructures/map.rho b/12-DataStructures/map.rho index 72e5045..6d9a598 100644 --- a/12-DataStructures/map.rho +++ b/12-DataStructures/map.rho @@ -1,4 +1,4 @@ -new mCh, print(`rho:io:stdout`) in { +new print, mCh in { mCh!!({"a": 3, "b": 4, "c": 5})| diff --git a/12-DataStructures/set.rho b/12-DataStructures/set.rho index d066b44..7c98df9 100644 --- a/12-DataStructures/set.rho +++ b/12-DataStructures/set.rho @@ -1,46 +1,46 @@ -new sCh, stdout(`rho:io:stdout`) in { +new result, sCh, result in { sCh!!(Set(3, 4, 5))| // Test toByteArray for (@s <- sCh){ - stdout!(["Test toByteArray. Got: ", s.toByteArray()]) + result!(["Test toByteArray. Got: ", s.toByteArray()]) } | // Test Add for (@s <- sCh){ - stdout!(["Test add. Expected Set(3, 4, 5, 6), Got: ", s.add(6)]) + result!(["Test add. Expected Set(3, 4, 5, 6), Got: ", s.add(6)]) } | // Test Diff for (@s <- sCh){ - stdout!(["Test diff. Expected: Set(5) Got: ", s.diff(Set(3, 4))]) + result!(["Test diff. Expected: Set(5) Got: ", s.diff(Set(3, 4))]) } | // Test Union for (@s <- sCh){ - stdout!(["Test union. Expected: Set(1, 2, 3, 4, 5). Got: ", s.union(Set(1, 2))]) + result!(["Test union. Expected: Set(1, 2, 3, 4, 5). Got: ", s.union(Set(1, 2))]) } | // Test Delete for (@s <- sCh){ - stdout!(["Test delete. Expected: Set(3, 4). Got: ", s.delete(5)]) + result!(["Test delete. Expected: Set(3, 4). Got: ", s.delete(5)]) } | // Test Contains for (@s <- sCh){ - stdout!(["Test contains. Expected: true. Got:", s.contains(5)])| - stdout!(["Test contains. Expected: false. Got: ", s.contains(6)]) + result!(["Test contains. Expected: true. Got:", s.contains(5)])| + result!(["Test contains. Expected: false. Got: ", s.contains(6)]) } | // Test Size for (@s <- sCh){ - stdout!("Test size. Expected 3. Got: ${ans}" %% {"ans": s.size()}) + result!("Test size. Expected 3. Got: ${ans}" %% {"ans": s.size()}) } } diff --git a/12-DataStructures/tuple.rho b/12-DataStructures/tuple.rho index 37bfca6..d8e1204 100644 --- a/12-DataStructures/tuple.rho +++ b/12-DataStructures/tuple.rho @@ -1,4 +1,4 @@ -new tCh, print(`rho:io:stdout`) in { +new print, tCh in { tCh!!((3, 4, 5))| diff --git a/12-DataStructures/wordLength.rho b/12-DataStructures/wordLength.rho index 499a299..41b7ee4 100644 --- a/12-DataStructures/wordLength.rho +++ b/12-DataStructures/wordLength.rho @@ -1,8 +1,8 @@ -new wordLength, stdout(`rho:io:stdout`) in { +new result, wordLength, result in { contract wordLength(@word) = { - stdout!("How many characters in " ++ word)| - stdout!(word.length())| - stdout!("Shorter version: " ++ word.slice(0, 5)) + result!("How many characters in " ++ word)| + result!(word.length())| + result!("Shorter version: " ++ word.slice(0, 5)) } | wordLength!("Cantaloupe") diff --git a/15-GoingOffChain/insertArbitrary.rho b/15-GoingOffChain/insertArbitrary.rho index 178c16b..eb547a2 100644 --- a/15-GoingOffChain/insertArbitrary.rho +++ b/15-GoingOffChain/insertArbitrary.rho @@ -1,7 +1,7 @@ -new doubler, +new result, doubler, uriChan, - insertArbitrary(`rho:registry:insertArbitrary`), - stdout(`rho:io:stdout`) in { + insertArbitrary(`rho:registry:insertArbitrary`) + in { // This is a silly contract that we'll register contract doubler(@n /\ Int, return) = { @@ -14,6 +14,6 @@ new doubler, // Wait for URI response for(@uri <- uriChan) { - stdout!(uri) + result!(uri) } } diff --git a/15-GoingOffChain/lookup.rho b/15-GoingOffChain/lookup.rho index a723e10..922ea2a 100644 --- a/15-GoingOffChain/lookup.rho +++ b/15-GoingOffChain/lookup.rho @@ -1,6 +1,5 @@ -new doublerCh, - lookup(`rho:registry:lookup`), - stdout(`rho:io:stdout`) in { +new result, doublerCh, + lookup(`rho:registry:lookup`), result in { // Ask the registry to lookup the URI and send the contract back on doublerCh lookup!(`rho:id:fos1m8yaki3s8g1ytzkr6boucnhab6nafoco8ww63xqj5k8aa1xfza`, *doublerCh) | @@ -8,7 +7,7 @@ new doublerCh, // Wait to receive the answer back from the registry for( doubler <- doublerCh) { - // Double a number and send the answer to stdout - doubler!(7, *stdout) + // Double a number and send the answer to result + doubler!(7, *result) } } diff --git a/converter/package-lock.json b/converter/package-lock.json index 6dd3a0d..5913225 100644 --- a/converter/package-lock.json +++ b/converter/package-lock.json @@ -10,9 +10,9 @@ "integrity": "sha1-invTcYa23d84E/I4WLV+yq9eQdQ=" }, "marked": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.5.0.tgz", - "integrity": "sha512-UhjmkCWKu1SS/BIePL2a59BMJ7V42EYtTfksodPRXzPEGEph3Inp5dylseqt+KbU9Jglsx8xcMKmlumfJMBXAA==" + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/marked/-/marked-0.5.2.tgz", + "integrity": "sha512-fdZvBa7/vSQIZCi4uuwo2N3q+7jJURpMVCcbaX0S1Mg65WZ5ilXvC67MviJAsdjqqgD+CEq4RKo5AYGgINkVAA==" } } } diff --git a/converter/package.json b/converter/package.json index 7d727bc..7d0d0a8 100644 --- a/converter/package.json +++ b/converter/package.json @@ -17,6 +17,6 @@ "license": "ISC", "dependencies": { "fs": "0.0.1-security", - "marked": "^0.5.0" + "marked": "^0.5.2" } } From 8ad4898a23c529411a18317a2cd80738154fffda Mon Sep 17 00:00:00 2001 From: Jim Whitescarver Date: Thu, 29 Oct 2020 14:20:13 -0400 Subject: [PATCH 4/8] more stdout fixes for exploredeploy --- 01-SendingAndStandardOut/README.md | 2 +- 01-SendingAndStandardOut/README_CN.md | 4 ++-- 01-SendingAndStandardOut/README_RU.md | 4 ++-- 03-TelephoneNamesAndProcesses/README_CN.md | 4 ++-- 03-TelephoneNamesAndProcesses/README_RU.md | 4 ++-- 06-UnforgeableNamesAndAcks/README_CN.md | 4 ++-- 06-UnforgeableNamesAndAcks/README_RU.md | 4 ++-- 07-BundlesAndInterpolation/README_CN.md | 2 +- 10-MoreSyntax/README_CN.md | 10 +++++----- 12-DataStructures/README.md | 2 +- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/01-SendingAndStandardOut/README.md b/01-SendingAndStandardOut/README.md index 09481a7..3de8d45 100644 --- a/01-SendingAndStandardOut/README.md +++ b/01-SendingAndStandardOut/README.md @@ -21,7 +21,7 @@ The heart of rholang is communicating on channels. Channels are communication li ![Redo this diagram!](sendSyntax.png) -We created the channel `result` on the first line of the program with `new result`. You'll create lots of channels as you learn rholang. We also gave our channel a special power by including `(rho:io:result)`. More on that later, but for now just know that you need that part in parentheses to make text actually appear on the screen. +We created the channel `result` on the first line of the program with `new result`. You'll create lots of channels as you learn rholang. The first new channel defined will be returned as the result of an explore deploy. More on that later, but for now just know that you need that the first channel name will give you a result of an explore. For an actual deploy onto the blockchain the value retuned will be on a special deployId channel. ## Using other channels diff --git a/01-SendingAndStandardOut/README_CN.md b/01-SendingAndStandardOut/README_CN.md index c13d710..fe07fa5 100644 --- a/01-SendingAndStandardOut/README_CN.md +++ b/01-SendingAndStandardOut/README_CN.md @@ -72,9 +72,9 @@ Storage Contents: ## 小测试 -`stdout!("Programming!")` 将在屏幕上输出什么? +`result!("Programming!")` 将在屏幕上输出什么? - [x] Programming! -- [ ] stdout! +- [ ] result! - [ ] Nothing diff --git a/01-SendingAndStandardOut/README_RU.md b/01-SendingAndStandardOut/README_RU.md index 22b05f6..52d463a 100644 --- a/01-SendingAndStandardOut/README_RU.md +++ b/01-SendingAndStandardOut/README_RU.md @@ -77,9 +77,9 @@ Storage Contents: ## Тест -Что выведет на экран фраза `stdout!("Programming!")` ? +Что выведет на экран фраза `result!("Programming!")` ? - [x] Programming! -- [ ] stdout! +- [ ] result! - [ ] Ничего diff --git a/03-TelephoneNamesAndProcesses/README_CN.md b/03-TelephoneNamesAndProcesses/README_CN.md index 1e573e5..8aeef29 100644 --- a/03-TelephoneNamesAndProcesses/README_CN.md +++ b/03-TelephoneNamesAndProcesses/README_CN.md @@ -39,7 +39,7 @@ "processes"可以是rholang中任何一个代码片段,例如我们的传话筒游戏,或者是披萨店订单程序。“process”可以是上百行的大程序,也可以只有几行。它们甚至可以是用于表示值的代码。下面是一些“process”的例子。 - - `stdout!("Sup Rholang?")` 一个常见的发送操作。 + - `result!("Sup Rholang?")` 一个常见的发送操作。 - `Nil` 最小的“process”。如字面意思,它不做任何事。 - `for(msg <- @"phone"){Nil}` 一个常见的接收操作,在消息到达时它不会做任何事。 - `"Hello World"` 另一个不做任何事请的小“process”。被称为"基础术语"。 @@ -123,7 +123,7 @@ Aice通过`for(message <- @"Alice")`接收我们的消息,所以, `message` - [ ] `@"BobsPhone"` - [ ] `*"BobsPhone"` - [ ] `@*BobsPhone` -- [ ] `stdout!("BobsPhone")` +- [ ] `result!("BobsPhone")` diff --git a/03-TelephoneNamesAndProcesses/README_RU.md b/03-TelephoneNamesAndProcesses/README_RU.md index 8ac23c8..8b023ee 100644 --- a/03-TelephoneNamesAndProcesses/README_RU.md +++ b/03-TelephoneNamesAndProcesses/README_RU.md @@ -39,7 +39,7 @@ "Процесс" -- любой кусок кода на ро. Например, наша игра в сломанный телефон или пиццерия из предыдущих уроков. Процессы могуть быть программами на сотни строк или кусочками на одну строчку. Они даже могут быть крошечными фрагментами кода, которые представляют собой значения. Вот примеры процессов: - - `stdout!("Sup Rholang?")` Обычная отправка + - `result!("Sup Rholang?")` Обычная отправка - `Nil` Наименьший возможный процесс. Он буквально значит "ничего не делать". - `for(msg <- @"phone"){Nil}` Обычное получение, которые ничего не делает, когда поступает сообщение. - `"Hello World"` Ещё один маленький процесс, который ничего не делает. Такие процессы называются "базовыми выражениями" ("Ground Terms"). @@ -120,7 +120,7 @@ What is `@Nil`? - [ ] `@"BobsPhone"` - [ ] `*"BobsPhone"` - [ ] `@*BobsPhone` -- [ ] `stdout!("BobsPhone")` +- [ ] `result!("BobsPhone")` diff --git a/06-UnforgeableNamesAndAcks/README_CN.md b/06-UnforgeableNamesAndAcks/README_CN.md index d227aec..0af7db0 100644 --- a/06-UnforgeableNamesAndAcks/README_CN.md +++ b/06-UnforgeableNamesAndAcks/README_CN.md @@ -132,7 +132,7 @@ Bob也想要订一份披萨,给出一个不可伪造的ack通道。我们应 ### 练习 -`stdout!("1")|stdout!("2")|stdout!("3")` +`result!("1")|stdout!("2")|stdout!("3")` 注意这段程序不会按照一定的顺序打印出数字。他们是同时发生的。想象我们现在真的要按照顺序打印几行。修改代码,使用ack通道来保证数字按顺序打印出来。 ### 练习 @@ -142,7 +142,7 @@ new myChan in { myChan!("Hi There") } | -for (msg <- myChan) {stdout!(*msg)} +for (msg <- myChan) {result!(*msg)} ``` 如果你对上面的程序预测失败,修改程序,让程序按照你的想法运行。 diff --git a/06-UnforgeableNamesAndAcks/README_RU.md b/06-UnforgeableNamesAndAcks/README_RU.md index df521b6..b9bfa6e 100644 --- a/06-UnforgeableNamesAndAcks/README_RU.md +++ b/06-UnforgeableNamesAndAcks/README_RU.md @@ -133,7 +133,7 @@ ### Упражнение -`stdout!("1")|stdout!("2")|stdout!("3")` +`result!("1")|stdout!("2")|stdout!("3")` Обратите внимание, что эта программа выводит числа в случайном порядке. Вызовы происходят одновременно. Представьте, что нам очень важно, чтобы эти строчки выводились по порядку. Измените код, используя каналы подтверждения, чтобы быть уверенным в нужной последовательности вывода. ### Упражнение @@ -143,7 +143,7 @@ new myChan in { myChan!("Hi There") } | -for (msg <- myChan) {stdout!(*msg)} +for (msg <- myChan) {result!(*msg)} ``` Если вы ошиблись в своих прогнозах, то измените программу так, чтобы она действительно делала то, на что вы рассчитывали. diff --git a/07-BundlesAndInterpolation/README_CN.md b/07-BundlesAndInterpolation/README_CN.md index 38a0c0e..92eaf43 100644 --- a/07-BundlesAndInterpolation/README_CN.md +++ b/07-BundlesAndInterpolation/README_CN.md @@ -58,7 +58,7 @@ Alice可以通过让粉丝请求她的粉丝邮箱地址来节省邮资。然后 练习: 当他们抓住球的时候,使用stdoutAck来显示每个人实际上的分数。 -大多数程序语言都允许你组合或者"串联"两个字符串在一起,当然Rholang也不例外了。我们可以 `stdout!("Hello " ++ "world")`, 但是我们不能串联一个字符串和一个整型。那就是为什么我们要用`stdoutAck`这个方法。另一个方法就是打印一个列表 `stdout!(["Bill caught it. Points earned: ", *points])`。我们将在未来课程讨论更多关于这方面的细节。 +大多数程序语言都允许你组合或者"串联"两个字符串在一起,当然Rholang也不例外了。我们可以 `result!("Hello " ++ "world")`, 但是我们不能串联一个字符串和一个整型。那就是为什么我们要用`stdoutAck`这个方法。另一个方法就是打印一个列表 `stdout!(["Bill caught it. Points earned: ", *points])`。我们将在未来课程讨论更多关于这方面的细节。 在rholang里的这个游戏与现实中一个球不断重复抛有什么区别? - [ ] 是相当准确的模拟 diff --git a/10-MoreSyntax/README_CN.md b/10-MoreSyntax/README_CN.md index 0dbefe3..b14def7 100644 --- a/10-MoreSyntax/README_CN.md +++ b/10-MoreSyntax/README_CN.md @@ -14,7 +14,7 @@ [greeter.rho](greeter.rho) -代码 `stdout!("I" ++ "<3" ++ "rholang")` 会输出什么? +代码 `result!("I" ++ "<3" ++ "rholang")` 会输出什么? - [ ] I <3 rholang - [ ] ["I", "<3", "rholang"] - [x] I<3rholang @@ -47,7 +47,7 @@ ### 练习 重看一下第三课中传音筒的游戏,那个展示我们已经使用了`@message`的语法模式,所以`message`是一个"process" -我们应该把 `for(@x <- @y){stdout!(...)}` 中 ... 替换为什么来让程序是正确的? +我们应该把 `for(@x <- @y){result!(...)}` 中 ... 替换为什么来让程序是正确的? - [ ] `@x` - [x] `x` - [ ] `*x` @@ -103,17 +103,17 @@ Rholang也有传统的布尔操作符, AND, OR, 和 NOT。语法是 * 当 `a`是假的 ,`not a` 是真的 -`stdout!(true and true)` 会输出什么?? +`result!(true and true)` 会输出什么?? - [x] true - [ ] false - [ ] 都不是; 非法语法 -`stdout!(not true)` 会输出什么? +`result!(not true)` 会输出什么? - [ ] true - [x] false - [ ] 都不是; 非法语法 -`stdout!((not not true) or false)` 会输出什么? +`result!((not not true) or false)` 会输出什么? - [x] true - [ ] false - [ ] 都不是; 非法语法 diff --git a/12-DataStructures/README.md b/12-DataStructures/README.md index bf6738d..a6c7f97 100644 --- a/12-DataStructures/README.md +++ b/12-DataStructures/README.md @@ -144,7 +144,7 @@ We've learned about several interesting data structures in this lesson. Data str In this example, Alice and Bob each have one unforgeable name (that I've called key). The keys may be useful on their own (for things not shown in the snippet), but only when used together, can the contract shown be called. This is known as "rights amplification". ``` -new alice, bob, key1, key2, result(`rho:io:result`) in { +new result, alice, bob, key1, key2 in { alice!(*key1)| bob!(*key2)| From 67886758d994fa01c27bc684cde62bfcef1e4825 Mon Sep 17 00:00:00 2001 From: Jim Whitescarver Date: Thu, 29 Oct 2020 14:49:53 -0400 Subject: [PATCH 5/8] add compete deploy process --- converter/README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/converter/README.md b/converter/README.md index 85665bf..f5ea5f3 100644 --- a/converter/README.md +++ b/converter/README.md @@ -7,3 +7,16 @@ run node ../converter/index.js index.md The output is in ./index.html https://marked.js.org/#/USING_PRO.md + + +``` +git clone https://github.com/rchain-community/LearnRholangByExample +cd LearnRholangByExample +npm install +npm install marked +node converter/index.js README.md +for d in */.; do cd $d;ls *.md| while read f; do node ../converter/index.js $f; done; cd ..; done +find . -name README.html |while read f; do cp -p $f $(echo $f|sed 's/README/index/');done +cd .. +rm -r node-modules +scp -r LearnRholangByExample rchain@rhobot.net:/var/www/html From d8e9ba1cc4e42811d03f3ddf805fe8209860002f Mon Sep 17 00:00:00 2001 From: Jim Whitescarver Date: Thu, 29 Oct 2020 15:39:18 -0400 Subject: [PATCH 6/8] remove redundant result channel --- 03-TelephoneNamesAndProcesses/telephone3.rho | 2 +- 04-PersistentSendAndPeek/grandmaCheck.rho | 2 +- 04-PersistentSendAndPeek/peek.rho | 2 +- 04-PersistentSendAndPeek/persistentSend.rho | 2 +- 04-PersistentSendAndPeek/putBack.rho | 2 +- 04-PersistentSendAndPeek/putBackAnswer.rho | 2 +- 05-JoinOperator/launch.rho | 2 +- 05-JoinOperator/launchBad.rho | 2 +- 05-JoinOperator/patienceSolution.rho | 2 +- 06-UnforgeableNamesAndAcks/newPizzaShop.rho | 2 +- 07-BundlesAndInterpolation/fanmailAsk.rho | 2 +- 07-BundlesAndInterpolation/fanmailBad.rho | 2 +- 07-BundlesAndInterpolation/fanmailPublish.rho | 2 +- 07-BundlesAndInterpolation/jackpot.rho | 2 +- 07-BundlesAndInterpolation/jackpotPublish.rho | 2 +- 08-StateChannelsAndMethods/counter.rho | 2 +- 08-StateChannelsAndMethods/counterFactory.rho | 2 +- 08-StateChannelsAndMethods/patience.rho | 2 +- 09-ObjectCapabilities/atc.rho | 2 +- 11-PatternMatching/matching.rho | 2 +- 11-PatternMatching/sendASend.rho | 2 +- 12-DataStructures/list.rho | 2 +- 12-DataStructures/set.rho | 2 +- 12-DataStructures/wordLength.rho | 2 +- 15-GoingOffChain/lookup.rho | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/03-TelephoneNamesAndProcesses/telephone3.rho b/03-TelephoneNamesAndProcesses/telephone3.rho index 6c10363..35cfb57 100644 --- a/03-TelephoneNamesAndProcesses/telephone3.rho +++ b/03-TelephoneNamesAndProcesses/telephone3.rho @@ -1,4 +1,4 @@ -new result, alice, bob, result in { +new result, alice, bob in { // Start the game by sending a message to Alice alice!("How to program: Change stuff and see what happens.") | diff --git a/04-PersistentSendAndPeek/grandmaCheck.rho b/04-PersistentSendAndPeek/grandmaCheck.rho index 01b7169..3a3d1d6 100644 --- a/04-PersistentSendAndPeek/grandmaCheck.rho +++ b/04-PersistentSendAndPeek/grandmaCheck.rho @@ -1,4 +1,4 @@ -new result, grandma, result in { +new result, grandma in { // I send the message grandma!("Meet at the mall at 4:00") | diff --git a/04-PersistentSendAndPeek/peek.rho b/04-PersistentSendAndPeek/peek.rho index 683ff1e..59a0eda 100644 --- a/04-PersistentSendAndPeek/peek.rho +++ b/04-PersistentSendAndPeek/peek.rho @@ -1,5 +1,5 @@ -new result, airportInfo, result in { +new result, airportInfo in { // ATC sends the info airportInfo!("No wind; Runway 11") | diff --git a/04-PersistentSendAndPeek/persistentSend.rho b/04-PersistentSendAndPeek/persistentSend.rho index 685b0a8..28380f4 100644 --- a/04-PersistentSendAndPeek/persistentSend.rho +++ b/04-PersistentSendAndPeek/persistentSend.rho @@ -1,4 +1,4 @@ -new result, airportInfo, result in { +new result, airportInfo in { // ATC sends the info airportInfo!!("No wind; Runway 11") | diff --git a/04-PersistentSendAndPeek/putBack.rho b/04-PersistentSendAndPeek/putBack.rho index 38cc5e0..ec86790 100644 --- a/04-PersistentSendAndPeek/putBack.rho +++ b/04-PersistentSendAndPeek/putBack.rho @@ -1,4 +1,4 @@ -new result, airportInfo, result in { +new result, airportInfo in { // ATC sends the info airportInfo!("No wind; Runway 11") | diff --git a/04-PersistentSendAndPeek/putBackAnswer.rho b/04-PersistentSendAndPeek/putBackAnswer.rho index 57554ee..85c008f 100644 --- a/04-PersistentSendAndPeek/putBackAnswer.rho +++ b/04-PersistentSendAndPeek/putBackAnswer.rho @@ -1,4 +1,4 @@ -new result, airportInfo, result in { +new result, airportInfo in { // ATC sends the info airportInfo!("No wind; Runway 11") | diff --git a/05-JoinOperator/launch.rho b/05-JoinOperator/launch.rho index 4cc4bdc..d2480de 100644 --- a/05-JoinOperator/launch.rho +++ b/05-JoinOperator/launch.rho @@ -1,4 +1,4 @@ -new result, aliceLaunch, bobLaunch, result in { +new result, aliceLaunch, bobLaunch in { // Listen for both launch commands for (x <- aliceLaunch; y <- bobLaunch){ result!("Launching the rocket") diff --git a/05-JoinOperator/launchBad.rho b/05-JoinOperator/launchBad.rho index 42dbd7b..21ec169 100644 --- a/05-JoinOperator/launchBad.rho +++ b/05-JoinOperator/launchBad.rho @@ -1,6 +1,6 @@ // REMINDER: This is the BAD way to solve the problem. -new result, aliceLaunch, bobLaunch, result in { +new result, aliceLaunch, bobLaunch in { // Listen for Alice's then Bob's launch commands for (x <- aliceLaunch){ diff --git a/05-JoinOperator/patienceSolution.rho b/05-JoinOperator/patienceSolution.rho index edbe6ee..68ecd90 100644 --- a/05-JoinOperator/patienceSolution.rho +++ b/05-JoinOperator/patienceSolution.rho @@ -1,4 +1,4 @@ -new result, p1, p2, result in { +new result, p1, p2 in { // Send messages like in both orders p1!("Send any message") | p2!("Hope I win") | diff --git a/06-UnforgeableNamesAndAcks/newPizzaShop.rho b/06-UnforgeableNamesAndAcks/newPizzaShop.rho index 483eebb..d551a2c 100644 --- a/06-UnforgeableNamesAndAcks/newPizzaShop.rho +++ b/06-UnforgeableNamesAndAcks/newPizzaShop.rho @@ -1,4 +1,4 @@ -new result, pizzaShop, result in { +new result, pizzaShop in { // Same contract as before contract pizzaShop(order) = { diff --git a/07-BundlesAndInterpolation/fanmailAsk.rho b/07-BundlesAndInterpolation/fanmailAsk.rho index 9903a95..065e64d 100644 --- a/07-BundlesAndInterpolation/fanmailAsk.rho +++ b/07-BundlesAndInterpolation/fanmailAsk.rho @@ -1,4 +1,4 @@ -new result, alice, bob, eve, result in { +new result, alice, bob, eve in { // Alice get a lot of fan mail, so she // creates a new write only bundle and publishes it. diff --git a/07-BundlesAndInterpolation/fanmailBad.rho b/07-BundlesAndInterpolation/fanmailBad.rho index 43e74bb..4fc386e 100644 --- a/07-BundlesAndInterpolation/fanmailBad.rho +++ b/07-BundlesAndInterpolation/fanmailBad.rho @@ -1,4 +1,4 @@ -new result, alice, result in { +new result, alice in { // Alice reads fan mail for (mail <- alice) { result!("Alice received a fanmail") diff --git a/07-BundlesAndInterpolation/fanmailPublish.rho b/07-BundlesAndInterpolation/fanmailPublish.rho index 5678864..779fb4d 100644 --- a/07-BundlesAndInterpolation/fanmailPublish.rho +++ b/07-BundlesAndInterpolation/fanmailPublish.rho @@ -1,4 +1,4 @@ -new result, alice, bob, eve, result in { +new result, alice, bob, eve in { // Alice gets a lot of fan mail, so she // creates a new write only bundle and publishes it. diff --git a/07-BundlesAndInterpolation/jackpot.rho b/07-BundlesAndInterpolation/jackpot.rho index a8b5e52..1321e2f 100644 --- a/07-BundlesAndInterpolation/jackpot.rho +++ b/07-BundlesAndInterpolation/jackpot.rho @@ -1,4 +1,4 @@ -new result, throw, result in { +new result, throw in { // Throw the ball worth five points throw!(5) | diff --git a/07-BundlesAndInterpolation/jackpotPublish.rho b/07-BundlesAndInterpolation/jackpotPublish.rho index c3e9dce..2eff570 100644 --- a/07-BundlesAndInterpolation/jackpotPublish.rho +++ b/07-BundlesAndInterpolation/jackpotPublish.rho @@ -1,4 +1,4 @@ -new result, gameCh, result in { +new result, gameCh in { new throw in { //Give out read-only access diff --git a/08-StateChannelsAndMethods/counter.rho b/08-StateChannelsAndMethods/counter.rho index 6b344bc..265af70 100644 --- a/08-StateChannelsAndMethods/counter.rho +++ b/08-StateChannelsAndMethods/counter.rho @@ -1,4 +1,4 @@ -new result, currentCount, increase, reset, check, result in { +new result, currentCount, increase, reset, check in { // Starting the counter at 0 currentCount!(0) | diff --git a/08-StateChannelsAndMethods/counterFactory.rho b/08-StateChannelsAndMethods/counterFactory.rho index 5944eb0..889f163 100644 --- a/08-StateChannelsAndMethods/counterFactory.rho +++ b/08-StateChannelsAndMethods/counterFactory.rho @@ -1,4 +1,4 @@ -new result, counterFactory, result in { +new result, counterFactory in { contract counterFactory(increase, reset) = { new currentCount in { // Start the counter at zero diff --git a/08-StateChannelsAndMethods/patience.rho b/08-StateChannelsAndMethods/patience.rho index 0cfd1eb..8abf929 100644 --- a/08-StateChannelsAndMethods/patience.rho +++ b/08-StateChannelsAndMethods/patience.rho @@ -1,4 +1,4 @@ -new result, P1, P2, result in { +new result, P1, P2 in { // active gets its own scope so players can't change its value. new active in { diff --git a/09-ObjectCapabilities/atc.rho b/09-ObjectCapabilities/atc.rho index 3f72904..45592d6 100644 --- a/09-ObjectCapabilities/atc.rho +++ b/09-ObjectCapabilities/atc.rho @@ -1,5 +1,5 @@ -new result, stationFactory, result in { +new result, stationFactory in { contract stationFactory(initialMessage, getInfo, setInfo) = { new currentMessage in { // Populate the initial message diff --git a/11-PatternMatching/matching.rho b/11-PatternMatching/matching.rho index 42eab78..92ea49f 100644 --- a/11-PatternMatching/matching.rho +++ b/11-PatternMatching/matching.rho @@ -1,4 +1,4 @@ -new result, patternMatcher, result in { +new result, patternMatcher in { for (x <= patternMatcher) { match *x { diff --git a/11-PatternMatching/sendASend.rho b/11-PatternMatching/sendASend.rho index 5cb45ac..63d4c83 100644 --- a/11-PatternMatching/sendASend.rho +++ b/11-PatternMatching/sendASend.rho @@ -1,4 +1,4 @@ -new result, patternMatcher, result in { +new result, patternMatcher in { for (x <= patternMatcher) { match *x { diff --git a/12-DataStructures/list.rho b/12-DataStructures/list.rho index 9157f9c..3174b91 100644 --- a/12-DataStructures/list.rho +++ b/12-DataStructures/list.rho @@ -1,4 +1,4 @@ -new result, lCh, result in { +new result, lCh in { // Make a new list, l lCh!!([3, 4, 5])| diff --git a/12-DataStructures/set.rho b/12-DataStructures/set.rho index 7c98df9..af53cb1 100644 --- a/12-DataStructures/set.rho +++ b/12-DataStructures/set.rho @@ -1,4 +1,4 @@ -new result, sCh, result in { +new result, sCh in { sCh!!(Set(3, 4, 5))| diff --git a/12-DataStructures/wordLength.rho b/12-DataStructures/wordLength.rho index 41b7ee4..79a9989 100644 --- a/12-DataStructures/wordLength.rho +++ b/12-DataStructures/wordLength.rho @@ -1,4 +1,4 @@ -new result, wordLength, result in { +new result, wordLength in { contract wordLength(@word) = { result!("How many characters in " ++ word)| result!(word.length())| diff --git a/15-GoingOffChain/lookup.rho b/15-GoingOffChain/lookup.rho index 922ea2a..8d1163e 100644 --- a/15-GoingOffChain/lookup.rho +++ b/15-GoingOffChain/lookup.rho @@ -1,5 +1,5 @@ new result, doublerCh, - lookup(`rho:registry:lookup`), result in { + lookup(`rho:registry:lookup`) in { // Ask the registry to lookup the URI and send the contract back on doublerCh lookup!(`rho:id:fos1m8yaki3s8g1ytzkr6boucnhab6nafoco8ww63xqj5k8aa1xfza`, *doublerCh) | From 8956ab02b2459797c0be332fdbeb36fd30de27a1 Mon Sep 17 00:00:00 2001 From: Jim Whitescarver Date: Thu, 29 Oct 2020 15:44:50 -0400 Subject: [PATCH 7/8] fix bogus resultAck s.b. stdoutAck --- 06-UnforgeableNamesAndAcks/stdoutAck.rho | 4 ++-- 07-BundlesAndInterpolation/jackPotNicePrinting.rho | 2 +- 08-StateChannelsAndMethods/counterTests.rho | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/06-UnforgeableNamesAndAcks/stdoutAck.rho b/06-UnforgeableNamesAndAcks/stdoutAck.rho index a1af4a4..34ae225 100644 --- a/06-UnforgeableNamesAndAcks/stdoutAck.rho +++ b/06-UnforgeableNamesAndAcks/stdoutAck.rho @@ -1,7 +1,7 @@ new result, myAckChannel, - resultAck(`rho:io:stdoutAck`) in { + stdoutAck(`rho:io:stdoutAck`) in { - resultAck!("Print some words.", *myAckChannel) + stdoutAck!("Print some words.", *myAckChannel) | for (acknowledgement <- myAckChannel) { result!("Received an acknowledgement.") diff --git a/07-BundlesAndInterpolation/jackPotNicePrinting.rho b/07-BundlesAndInterpolation/jackPotNicePrinting.rho index 00a372a..0e7f47b 100644 --- a/07-BundlesAndInterpolation/jackPotNicePrinting.rho +++ b/07-BundlesAndInterpolation/jackPotNicePrinting.rho @@ -1,6 +1,6 @@ for (points <= @throw){ new ack in { - resultAck!("Bill caught it. Points earned: ", *ack) + stdoutAck!("Bill caught it. Points earned: ", *ack) | for( _ <- ack){ result!(*points) diff --git a/08-StateChannelsAndMethods/counterTests.rho b/08-StateChannelsAndMethods/counterTests.rho index f9e9d2d..d0d41c1 100644 --- a/08-StateChannelsAndMethods/counterTests.rho +++ b/08-StateChannelsAndMethods/counterTests.rho @@ -4,12 +4,12 @@ new result, ack in { increase!(*ack) | for(_ <- ack) { check!(*ack) | for(count <- ack) { - resultAck!(*count, *ack) | for(_ <- ack) { + stdoutAck!(*count, *ack) | for(_ <- ack) { increase!(*ack) | for(_ <- ack) { check!(*ack) | for(count <- ack) { - resultAck!(*count, *ack) | for(_ <- ack) { + stdoutAck!(*count, *ack) | for(_ <- ack) { reset!(*ack) | for(count <- ack) { From 7e607d317886368e6723412094e9526295efcd8e Mon Sep 17 00:00:00 2001 From: Jim Whitescarver Date: Thu, 29 Oct 2020 15:51:44 -0400 Subject: [PATCH 8/8] fix more bogus resultAck s.b. stdoutAck --- 06-UnforgeableNamesAndAcks/README.md | 6 +++--- 07-BundlesAndInterpolation/README.md | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/06-UnforgeableNamesAndAcks/README.md b/06-UnforgeableNamesAndAcks/README.md index 4d5164e..9fa5753 100644 --- a/06-UnforgeableNamesAndAcks/README.md +++ b/06-UnforgeableNamesAndAcks/README.md @@ -104,11 +104,11 @@ Bob also wants to order a pizza and give a unforgeable ack channel. Where should - [ ] On the same line Alice did - [ ] On the very first line of the program -## `resultAck` and `stderrAck` +## `stdoutAck` and `stderrAck` -Now that you understand ack channels, you should know about two other ways to print to the screen. They are channels called `resultAck` and `stderrAck`. They work just like their cousins from lesson 1, but they take an ack channel. +Now that you understand ack channels, you should know about two other ways to print to the screen. They are channels called `stdoutAck` and `stderrAck`. They work just like their cousins from lesson 1, but they take an ack channel. -[resultAck.rho](resultAck.rho) +[stdoutAck.rho](resultAck.rho) By the way, did you ever notice the handful of stuff that always starts in a fresh tuplespace? Four of those things are the built-in receives for the screen-printing channels. The others are for cryptography. We'll discuss them later. diff --git a/07-BundlesAndInterpolation/README.md b/07-BundlesAndInterpolation/README.md index bae7da0..3248ce2 100644 --- a/07-BundlesAndInterpolation/README.md +++ b/07-BundlesAndInterpolation/README.md @@ -57,7 +57,7 @@ Who will catch the ball in the jackpot code? ### Exercise -Exercise: Use resultAck to display how many points each person actually gets when they catch the ball. +Exercise: Use stdoutAck to display how many points each person actually gets when they catch the ball. @@ -72,7 +72,7 @@ How is this game in rholang different than the real game where one ball is throw ## Side Bar: String Operations Most programming languages will allow you to join or "concatenate" two strings together, and rholang is no exception. We can `result!("Hello " ++ "world")`, but we can't concatenate a string with an int. -One solution is to use `resultAck` andsend acknowledgements. Another option is to print a list `result!(["Bill caught it. Points earned: ", *points])`. We'll go into more detail about both techniques in future lessons. +One solution is to use `stdoutAck` andsend acknowledgements. Another option is to print a list `result!(["Bill caught it. Points earned: ", *points])`. We'll go into more detail about both techniques in future lessons. A final option is to use string interpolation. String interpolation allows you to put placeholders into your strings and replace them with actual values using a map.