joshorndorff / learnrholangbyexample Goto Github PK
View Code? Open in Web Editor NEWTeaches rholang to beginners and intermediate programmers through hands-on examples and experimentation.
Teaches rholang to beginners and intermediate programmers through hands-on examples and experimentation.
I really like the Cheat Sheet.
In the readme, the part on bundles is a little confusing. The last two examples seem to be the same but have different send or receive capabilities. Should the example part be different?
https://github.com/JoshOrndorff/LearnRholangByExample/tree/master/cheatSheet
bundle {proc} | NO | NO |
---|---|---|
bundle {proc} | YES | YES |
Both rows have "bundle {proc}". Is this right?
Sorry if this is just me, but I don't get the meaning of the content under 'Quoting and Unquoting'. What do the '/' slashes mean? Is this markdown that isn't being interpreted, or character-based art?
Quoting and Unquoting
"Send processes, receive names"
--@-- Process
/ /
Name <---*--
I like the "send processes, receive names" but does that mean when you send something it must be a process. This doesn't seem right. Does it really mean that you send on processes but when you get what comes over them it is a name? @"Foo"!("hello"), seems like @"Foo" is a process. Or is that not right "Foo" is a process and @ makes it a name you can send on? And then, when you receive on @"Foo" you get something that is a name? (but then you can put "for (@x <- @"Foo")" to make it a process? Totally confusing. Everyone else seems to get it, but I just add a @ or a * until it works. It would be awesome to really understand. Also there is a thing called a name-variable, and a process-variable. So, one could have just an 'x' but it is a process variable (no @ sign in front) but also a name 'x' that is a name-variable. This further confuses (I think. if I'm even right about name and process variables).
The (mirror) link next to the RCloud link in Ch0 gives me a 404 page.
Dan added nth
and length
. Document those.
If you have the files, can you make a .ZIP with all of the exercises in it and add them to an exercise folder in the tutorial? My thought behind this is to make it simpler for those who wants to stay in the RNode env to run the exercises in the standalone mode and have all of the files there. I can add the documentation in the 0-Developement Env folder on how to transfer the files and extract them. In addition, all they have to do is type: rnode eval ~/Rholang/<the_excersise_they_are_on>.rho as they are reading alongside the tutorial.
This is just an idea. We don't have to do this at all. its just, i find myself having to create new .rho files into my node just to test in the RNode env.
Specifically, in the grandmaCheck.rho I say I'm double checking a message I sent to grandma. But it's possible that she may receive it before I ever get to double check it.
A better example would be reading a value from a state channel, and leaving it also on the state channel. This example is also more complex.
The code "new print(rho:io:stdout
)" is a poor suggestion for usage. It creates another name for the same thing. A better pattern is:
"new stdout(rho:io:stdout
)"
Presumably, the pattern of rho:io:XYZ means that there will be more names at XYZ. Even the special prefix of "rho:io:" indicates there will be many more possible URI's. Creating a new name for each of these things is not a good practice.
I understand this is not technically wrong, the name that is mapped to the URI can be anything, but, if one were to have a program with tens of these names mapped (or if one used a library someday that used many tens of these), it would be much nicer to have a convention where the name used in the "new" is the same as at least the final portion of the URI. The usage of "new print(rho:io:stdout
)" forces the user to understand two names: "stdout" (which is the real name of the functionality), and "print", something made up by this example. It implies that "print" is some system capability which it is not. One could imagine example code where "print" is used all over the code. Does the code mean some other name which happens to be called "print" or, is it really "rho:io:stdout".
I suggest changing the example to: "new stdout(rho:io:stdout
)" and sticking with this pattern.
Reported by @pmoorman in rchain/bounties#919 (comment)
Bound & free names => I got confused about what “bound” means when I saw the first example. The text below it should maybe come before the example. Then it’s easier to (first the explanation, then the example)
Any designers up for the challenge?
0
The smallest possible process. It literally means "do nothing".
In some grammars, 0 is a symbol for the stopped process. Not so in rholang. The stopped process is written Nil
. The 0
process is an integer value.
I'm not sure it makes much difference...
I was able to make stdout say "Rholang Rocks!" but was confused once I tried to replace "stdout" with "someChannel". I later found out I wasn't supposed to succeed in having anything print to the screen, but in the meantime felt like I wasn't getting the exercise right. "Any results?" was a hint, but too subtle for me to catch.
Now I'm confused how I make "Sup World" print to the screen if someChannel won't go to the screen in the first place.
I suggest these exercises go after the "So where do the other channels go then? Nowhere! Not yet anyway." and before the tupleSpace.rho example exercise to avoid frustration at the outset.
for (@Int <- @"x") {
Nil
}
|
@"x"!(5)| // Matches
@"x"!("hi") // Doesn't match
stdout!("My name is ${name} and I'm ${age} years old" %% {"name": "Bob", "age": 18})
dckc showed how to encode select. This will solve the patience game that I couldn't figure out when writing the tutorial.
new once in {
once!(Nil) |
for(pat1 <- n1; _ <- once) { p1 } |
for(pat2 <- n2; _ <- once) { p2 }
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.