Giter VIP home page Giter VIP logo

learnrholangbyexample's Introduction

Learn Rholang By Example

Learn rholang by example and experimentation. The examples and exercises are meant to be run, read, modified and completed. For best results, change anything and everything you are curious about. This tutorial is a tour of the most common and important features of rholang and a fast starting point for motivated learners.

中文教程 версия на русском

Table of Contents

Unit 1

Unit 2

Unit 3

Target Audience

This tutorial aims to be novice-friendly and introduce rholang from the ground up. If you've never ever programmed before, you may struggle at times, but if you know how to write a little python or javascript, you've got all the background I've assumed.

You don't need to be familiar with process calculi, be a master of any other languages, or understand the underlying math.

Additional Resources

Author and License

Written by Joshy Orndorff.

Illustrations by Julianne Coxe.

Released under the Apache 2.0 license.

learnrholangbyexample's People

Contributors

barkov-f avatar dependabot[bot] avatar eknir avatar guilhermehas avatar joshorndorff avatar k0ala avatar sivkovav avatar t4sk avatar trenchfloat avatar zsluedem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

learnrholangbyexample's Issues

Adding a zip file with all of the .rho exercises

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.

0 vs. Nil for smallest / stopped process

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...

Ch 1 Exercises confusion

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.

Add clarity to 'Quoting and Unquoting'

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).

Peek example of double checking has race condition

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.

Proper solution to the patience game

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 }
}

Visual corrections

i think you should consider about having a visual breakdown of the code that shows the user what it looks like to print "Hello World" along with the definitions you defined. See example:
img_1606

Use of new print(`rho:io:stdout`) is a poor suggested usage

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.