+Output
+Output is exactly the same as -Output, however there is now an output command. Everything else is still the same, and all -Output programs are compatible with +Output. Read -Output for the basic idea.
The file extension is .poutput
Implementation
In -Output, it was required the memory or codebox be shown at the end of execution or live update. In +Output, this is no longer required, as there is an output command and reading from the memory or source code is no longer a must.
New instruction
op | Values popped | Description |
---|---|---|
o
|
x
|
Outputs x to the standard output.
|
That's it. There only needs to be one output command.
Examples
Hello, world!
"Hello, world!" o X
A + B problem & string concatenation
i& i& + o X
Input numbers to add them, input strings to concatenate them, input different types to get an error.
Truth-machine
in #v_0o X v1< >o^
Cat program
Loops until an empty string is provided.
>i:#v_X ^ o <
Cat program 2
This one is a one-time use.
ioX
It's pretty simple.
Add or subtract
Type sub
to subtract, anything else to add. Inputs are done in this order: num1, num2, operation (aka reverse Polish notation).
i&i&v v < >i"sub"=#v_+oX Xo+n<
Is greater than
Takes 2 inputs, and outputs whether the first is greater or less than the second. Inputting strings will use their length, so this doubles as a length comparator.
i&i&`#v_"Is less than or equal to"v >"Is greater than"oX Xo<
Number or string checker
Takes an input, and outputs whether it's a string or a number.
i&t#v_"Number">oX >"String" ^
Hi interpreter
il"hi"*oX
Print a 10x10 grid of asterisks
a"*"a*oaUo1n+:!#X_#
This is my code-golfed version. Check +Output#External resources
Reverse Polish Notation calculator
i" ".0r01j >:!#v_&:t#v_m01j >~)+(01j>~)n+(01j>~)*(01j>~)/( >)oX >:"+"=#^_:"-"=#^_ :"*"=#^_:"/"=~^
Enter input as one string to be evaluated, like 3 5 + 6 2 - * 2 /
and the program will print the answer.
Fixed Repeating Output
i&"1"*o"0"oX
A nice one-liner. Input a number.
Python implementation
I finally got around to making an interpreter for this language. It may be bad, but I don't care. It works.