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

Add more samples #281

Open
ForNeVeR opened this issue Oct 26, 2016 · 7 comments
Open

Add more samples #281

ForNeVeR opened this issue Oct 26, 2016 · 7 comments

Comments

@ForNeVeR
Copy link
Member

Current samples are not presentable enough. To show Morganey to guys, I want examples of "Hello world" and more simple examples with annotated output.

@rexim
Copy link
Member

rexim commented Oct 26, 2016

@ForNeVeR I'm sorry, but what do you mean by "annotated output"?

@rexim
Copy link
Member

rexim commented Oct 26, 2016

@ForNeVeR I've planned this for next Morning Tsoding. I'd really appreciate if you created a list of exact samples you need and it posted here. Later I'll implement this list right on the stream. Thanks!

@ForNeVeR
Copy link
Member Author

@rexim by "annotated output" I mean that you should write command output in comments. For example, (in python) that would be

print (2 + 2) # => 4

@ForNeVeR
Copy link
Member Author

...and I'll try to create the example list tonight.

@ForNeVeR
Copy link
Member Author

ForNeVeR commented Oct 26, 2016

So, okay, let's think about it.

  1. Add a "Hello world" program. (Seriously, we haven't one.)

  2. Add an arithmetic example. E.g. define and explain a multiply function (yeah, I know that the standard library have one), print a result of 2*8.

  3. Add an interactive example. echo program: read line and print it back.

  4. List functions example. ohce program: read line and print it back​_wards_.

  5. Add a complex interactive example. Read two numbers from stdin and print their sum. Read a list of numbers from stdin (is it possible? Could Morganey program detect EOF? If no, then the length of the list should be the first parameter read), print their product.

  6. Fun. Write a program that reads an optional name parameter from stdin and prints a message:

    <h1>Hello {name}</h1>
    Enter next name: <form><input name="name" /><button>Hi</button></form>
    

    Add an instruction to connect that to CGI. Why the hell not! I recommend to put additional parser in front of program that will parse and strip out HTTP headers and stuff.

@rexim, please feel free to split this task to multiple if you think that some of my ideas are too complex or you simply don't like them.

@rexim rexim assigned rexim and unassigned ForNeVeR Oct 26, 2016
@rexim
Copy link
Member

rexim commented Oct 26, 2016

@ForNeVeR thanks for the specs! I'll do mah best!

is it possible? Could Morganey program detect EOF? If no, then the length of the list should be the first parameter read

Yeah, it can. The input binding simply ends on EOF. We probably need to document it in https://github.com/morganey-lang/Morganey/wiki/Execution-Mode-Semantic#input-stream

@rexim
Copy link
Member

rexim commented Nov 4, 2016

The issue was split at #286

Pieces

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants