Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix peek syntax #48

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 04-PersistentSendAndPeek/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<!` operator.
To "peek" at what's on a channel without consuming it, use the `<<-` operator.

[peek.rho](peek.rho)


Which syntax is used to peek at a message?
- [x] `for (x <! y){...}`
- [x] `for (x <<- y){...}`
- [ ] `for (x <= y){...}`
- [ ] `x!!(y)`

Expand Down
3 changes: 1 addition & 2 deletions 04-PersistentSendAndPeek/peek.rho
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
// REMINDER: Peek is not yet implemented

new airportInfo, stdout(`rho:io:stdout`) in {
// ATC sends the info
airportInfo!("No wind; Runway 11")
|

// Pilot receives the info
for (info <! airportInfo) {
for (info <<- airportInfo) {
stdout!(*info)
}
|
Expand Down