String Manipulation InterpreterString manipulationadd commas to Numbers without String manipulationPi language interpreterBrainFlow Interpreter!Interpret /// (pronounced 'slashes')Code Golf: Gibberish EchoInterpreted InterpreterRemove more than n consecutive vowels from input stringMake a Unicorn interpreterShortest Unique Substring

What's the output of a record cartridge playing an out-of-speed record

Can I make popcorn with any corn?

Why do falling prices hurt debtors?

How can I prevent hyper evolved versions of regular creatures from wiping out their cousins?

Dragon forelimb placement

Finding angle with pure Geometry.

Is it tax fraud for an individual to declare non-taxable revenue as taxable income? (US tax laws)

How is it possible to have an ability score that is less than 3?

What is the offset in a seaplane's hull?

Minkowski space

Why do I get two different answers for this counting problem?

What defenses are there against being summoned by the Gate spell?

Why was the small council so happy for Tyrion to become the Master of Coin?

Accidentally leaked the solution to an assignment, what to do now? (I'm the prof)

What is the word for reserving something for yourself before others do?

Collect Fourier series terms

Why "Having chlorophyll without photosynthesis is actually very dangerous" and "like living with a bomb"?

Watching something be written to a file live with tail

tikz: show 0 at the axis origin

Is it possible to do 50 km distance without any previous training?

Can divisibility rules for digits be generalized to sum of digits

Theorems that impeded progress

String Manipulation Interpreter

Is a tag line useful on a cover?



String Manipulation Interpreter


String manipulationadd commas to Numbers without String manipulationPi language interpreterBrainFlow Interpreter!Interpret /// (pronounced 'slashes')Code Golf: Gibberish EchoInterpreted InterpreterRemove more than n consecutive vowels from input stringMake a Unicorn interpreterShortest Unique Substring













4












$begingroup$


Summary



A new string manipulation language has been made, using only the characters $+#-!*|@>! Your task is to implement an interpreter for it in as few bytes as possible.



Input



A string, which is a line of this language. This can be taken in any reasonable way (stdin, function parameter, command line argument etc.), or as a predefined variable. If the program asks for user input, accept all user input it asks for from stdin and nothing more, see below. You may assume it is a valid program.



Output



Whatever the language would output, specifications below. You must output a string, in any reasonable way (stdout, function output, etc.), or a variable value. When the language outputs explicitly, this must go to stdout. Standard loopholes are banned.



Language Specifications



Processing and Syntax



The language has a very simple form of processing as it does only string manipulation: it starts with an empty string (""), and changes it with each term. A term is made up of one or two parts: a function (below) followed by possibly a parameter(below), which edits its behaviour. Terms are separated by pipes (|). You may assume it will not be an empty program, and no term will be empty. You should output the value at the end of the program.



Functions



The language has just 6 functions, as shown below. Each function either accepts one or zero parameters.




  • + concatenate strings (takes one string parameter, concatenates it to the current value)


  • ! reverse the character order of the current value (no parameter)


  • * repeat the string (takes one integer parameter, repeats the current value that many times)


  • - removes all occurrences of a value (takes one string parameter, removes all occurrences of it from the current value)


  • $ [pseudo-]randomly shuffles the current value (no parameter)


  • < output the current value to stdout (no parameters)

Values



These are the values that may be passed to functions, represented by regex that would match them:




  • @[^|]* a string literal, including any character other than pipes. It may be empty.


  • #[0-9]+ an integer literal


  • > the next line of stdin. If used with *, convert to integer.

Test Cases



╔════════════════════════╤═════════════╤══════════════╗
║code │input │output ║
╟────────────────────────┼─────────────┼──────────────╢
║+>|!|+@hello|*> │13 │ ║
║ │2 │31hello31hello║
╟────────────────────────┼─────────────┼──────────────╢
║+>|+@abcdefg|$ │hello │hcloeebafdlg ║
╟────────────────────────┼─────────────┼──────────────╢
║+@how areyou|-@o|-> │w │h areyu ║
╟────────────────────────┼─────────────┼──────────────╢
║+@out|<|*#3 │ │out ║
║ │ │outoutout ║
╟────────────────────────┼─────────────┼──────────────╢
║+> │what ever 345│what ever 345 ║
╟────────────────────────┼─────────────┼──────────────╢
║+@$pe<i@l|<|-@$pe<i@l|+>│A|$o $pe<!@| │$pe<i@l ║
║ │ │A|$o $pe<!@| ║
╚════════════════════════╧═════════════╧══════════════╝


Note that test case 2 is random, so any permutation of the characters in it is valid. Also, the outputs in the table are seperated by newlines, but your program doesn't have to do the same. The last value in each case the the final output.



Example (Un-golfed) python interpreter



Try it online! IMO better if you run it through IDLE or whatever you use. (I golfed it down to 424 bytes after, but I'm sure you lot can do better).










share|improve this question











$endgroup$







  • 1




    $begingroup$
    Allowing input to already be in a variable is non-standard, as is allowing output to be in one.
    $endgroup$
    – Jonathan Allan
    3 hours ago











  • $begingroup$
    Are we allowed to take in a generator function instead of an array/list for the input?
    $endgroup$
    – Embodiment of Ignorance
    2 hours ago











  • $begingroup$
    Also, for <, if our answer is a function that returns a value, should I print in the middle of the function and return the final string?
    $endgroup$
    – Embodiment of Ignorance
    2 hours ago










  • $begingroup$
    @EmbodimentofIgnorance RE - Generator: No, it was and is stated in my question that it is the next line of stdin. RE - <: I have clarified in my question that it must print to stdout, except the final value.
    $endgroup$
    – Artemis Fowl
    2 hours ago










  • $begingroup$
    @JonathanAllan Question clarified.
    $endgroup$
    – Artemis Fowl
    2 hours ago















4












$begingroup$


Summary



A new string manipulation language has been made, using only the characters $+#-!*|@>! Your task is to implement an interpreter for it in as few bytes as possible.



Input



A string, which is a line of this language. This can be taken in any reasonable way (stdin, function parameter, command line argument etc.), or as a predefined variable. If the program asks for user input, accept all user input it asks for from stdin and nothing more, see below. You may assume it is a valid program.



Output



Whatever the language would output, specifications below. You must output a string, in any reasonable way (stdout, function output, etc.), or a variable value. When the language outputs explicitly, this must go to stdout. Standard loopholes are banned.



Language Specifications



Processing and Syntax



The language has a very simple form of processing as it does only string manipulation: it starts with an empty string (""), and changes it with each term. A term is made up of one or two parts: a function (below) followed by possibly a parameter(below), which edits its behaviour. Terms are separated by pipes (|). You may assume it will not be an empty program, and no term will be empty. You should output the value at the end of the program.



Functions



The language has just 6 functions, as shown below. Each function either accepts one or zero parameters.




  • + concatenate strings (takes one string parameter, concatenates it to the current value)


  • ! reverse the character order of the current value (no parameter)


  • * repeat the string (takes one integer parameter, repeats the current value that many times)


  • - removes all occurrences of a value (takes one string parameter, removes all occurrences of it from the current value)


  • $ [pseudo-]randomly shuffles the current value (no parameter)


  • < output the current value to stdout (no parameters)

Values



These are the values that may be passed to functions, represented by regex that would match them:




  • @[^|]* a string literal, including any character other than pipes. It may be empty.


  • #[0-9]+ an integer literal


  • > the next line of stdin. If used with *, convert to integer.

Test Cases



╔════════════════════════╤═════════════╤══════════════╗
║code │input │output ║
╟────────────────────────┼─────────────┼──────────────╢
║+>|!|+@hello|*> │13 │ ║
║ │2 │31hello31hello║
╟────────────────────────┼─────────────┼──────────────╢
║+>|+@abcdefg|$ │hello │hcloeebafdlg ║
╟────────────────────────┼─────────────┼──────────────╢
║+@how areyou|-@o|-> │w │h areyu ║
╟────────────────────────┼─────────────┼──────────────╢
║+@out|<|*#3 │ │out ║
║ │ │outoutout ║
╟────────────────────────┼─────────────┼──────────────╢
║+> │what ever 345│what ever 345 ║
╟────────────────────────┼─────────────┼──────────────╢
║+@$pe<i@l|<|-@$pe<i@l|+>│A|$o $pe<!@| │$pe<i@l ║
║ │ │A|$o $pe<!@| ║
╚════════════════════════╧═════════════╧══════════════╝


Note that test case 2 is random, so any permutation of the characters in it is valid. Also, the outputs in the table are seperated by newlines, but your program doesn't have to do the same. The last value in each case the the final output.



Example (Un-golfed) python interpreter



Try it online! IMO better if you run it through IDLE or whatever you use. (I golfed it down to 424 bytes after, but I'm sure you lot can do better).










share|improve this question











$endgroup$







  • 1




    $begingroup$
    Allowing input to already be in a variable is non-standard, as is allowing output to be in one.
    $endgroup$
    – Jonathan Allan
    3 hours ago











  • $begingroup$
    Are we allowed to take in a generator function instead of an array/list for the input?
    $endgroup$
    – Embodiment of Ignorance
    2 hours ago











  • $begingroup$
    Also, for <, if our answer is a function that returns a value, should I print in the middle of the function and return the final string?
    $endgroup$
    – Embodiment of Ignorance
    2 hours ago










  • $begingroup$
    @EmbodimentofIgnorance RE - Generator: No, it was and is stated in my question that it is the next line of stdin. RE - <: I have clarified in my question that it must print to stdout, except the final value.
    $endgroup$
    – Artemis Fowl
    2 hours ago










  • $begingroup$
    @JonathanAllan Question clarified.
    $endgroup$
    – Artemis Fowl
    2 hours ago













4












4








4


1



$begingroup$


Summary



A new string manipulation language has been made, using only the characters $+#-!*|@>! Your task is to implement an interpreter for it in as few bytes as possible.



Input



A string, which is a line of this language. This can be taken in any reasonable way (stdin, function parameter, command line argument etc.), or as a predefined variable. If the program asks for user input, accept all user input it asks for from stdin and nothing more, see below. You may assume it is a valid program.



Output



Whatever the language would output, specifications below. You must output a string, in any reasonable way (stdout, function output, etc.), or a variable value. When the language outputs explicitly, this must go to stdout. Standard loopholes are banned.



Language Specifications



Processing and Syntax



The language has a very simple form of processing as it does only string manipulation: it starts with an empty string (""), and changes it with each term. A term is made up of one or two parts: a function (below) followed by possibly a parameter(below), which edits its behaviour. Terms are separated by pipes (|). You may assume it will not be an empty program, and no term will be empty. You should output the value at the end of the program.



Functions



The language has just 6 functions, as shown below. Each function either accepts one or zero parameters.




  • + concatenate strings (takes one string parameter, concatenates it to the current value)


  • ! reverse the character order of the current value (no parameter)


  • * repeat the string (takes one integer parameter, repeats the current value that many times)


  • - removes all occurrences of a value (takes one string parameter, removes all occurrences of it from the current value)


  • $ [pseudo-]randomly shuffles the current value (no parameter)


  • < output the current value to stdout (no parameters)

Values



These are the values that may be passed to functions, represented by regex that would match them:




  • @[^|]* a string literal, including any character other than pipes. It may be empty.


  • #[0-9]+ an integer literal


  • > the next line of stdin. If used with *, convert to integer.

Test Cases



╔════════════════════════╤═════════════╤══════════════╗
║code │input │output ║
╟────────────────────────┼─────────────┼──────────────╢
║+>|!|+@hello|*> │13 │ ║
║ │2 │31hello31hello║
╟────────────────────────┼─────────────┼──────────────╢
║+>|+@abcdefg|$ │hello │hcloeebafdlg ║
╟────────────────────────┼─────────────┼──────────────╢
║+@how areyou|-@o|-> │w │h areyu ║
╟────────────────────────┼─────────────┼──────────────╢
║+@out|<|*#3 │ │out ║
║ │ │outoutout ║
╟────────────────────────┼─────────────┼──────────────╢
║+> │what ever 345│what ever 345 ║
╟────────────────────────┼─────────────┼──────────────╢
║+@$pe<i@l|<|-@$pe<i@l|+>│A|$o $pe<!@| │$pe<i@l ║
║ │ │A|$o $pe<!@| ║
╚════════════════════════╧═════════════╧══════════════╝


Note that test case 2 is random, so any permutation of the characters in it is valid. Also, the outputs in the table are seperated by newlines, but your program doesn't have to do the same. The last value in each case the the final output.



Example (Un-golfed) python interpreter



Try it online! IMO better if you run it through IDLE or whatever you use. (I golfed it down to 424 bytes after, but I'm sure you lot can do better).










share|improve this question











$endgroup$




Summary



A new string manipulation language has been made, using only the characters $+#-!*|@>! Your task is to implement an interpreter for it in as few bytes as possible.



Input



A string, which is a line of this language. This can be taken in any reasonable way (stdin, function parameter, command line argument etc.), or as a predefined variable. If the program asks for user input, accept all user input it asks for from stdin and nothing more, see below. You may assume it is a valid program.



Output



Whatever the language would output, specifications below. You must output a string, in any reasonable way (stdout, function output, etc.), or a variable value. When the language outputs explicitly, this must go to stdout. Standard loopholes are banned.



Language Specifications



Processing and Syntax



The language has a very simple form of processing as it does only string manipulation: it starts with an empty string (""), and changes it with each term. A term is made up of one or two parts: a function (below) followed by possibly a parameter(below), which edits its behaviour. Terms are separated by pipes (|). You may assume it will not be an empty program, and no term will be empty. You should output the value at the end of the program.



Functions



The language has just 6 functions, as shown below. Each function either accepts one or zero parameters.




  • + concatenate strings (takes one string parameter, concatenates it to the current value)


  • ! reverse the character order of the current value (no parameter)


  • * repeat the string (takes one integer parameter, repeats the current value that many times)


  • - removes all occurrences of a value (takes one string parameter, removes all occurrences of it from the current value)


  • $ [pseudo-]randomly shuffles the current value (no parameter)


  • < output the current value to stdout (no parameters)

Values



These are the values that may be passed to functions, represented by regex that would match them:




  • @[^|]* a string literal, including any character other than pipes. It may be empty.


  • #[0-9]+ an integer literal


  • > the next line of stdin. If used with *, convert to integer.

Test Cases



╔════════════════════════╤═════════════╤══════════════╗
║code │input │output ║
╟────────────────────────┼─────────────┼──────────────╢
║+>|!|+@hello|*> │13 │ ║
║ │2 │31hello31hello║
╟────────────────────────┼─────────────┼──────────────╢
║+>|+@abcdefg|$ │hello │hcloeebafdlg ║
╟────────────────────────┼─────────────┼──────────────╢
║+@how areyou|-@o|-> │w │h areyu ║
╟────────────────────────┼─────────────┼──────────────╢
║+@out|<|*#3 │ │out ║
║ │ │outoutout ║
╟────────────────────────┼─────────────┼──────────────╢
║+> │what ever 345│what ever 345 ║
╟────────────────────────┼─────────────┼──────────────╢
║+@$pe<i@l|<|-@$pe<i@l|+>│A|$o $pe<!@| │$pe<i@l ║
║ │ │A|$o $pe<!@| ║
╚════════════════════════╧═════════════╧══════════════╝


Note that test case 2 is random, so any permutation of the characters in it is valid. Also, the outputs in the table are seperated by newlines, but your program doesn't have to do the same. The last value in each case the the final output.



Example (Un-golfed) python interpreter



Try it online! IMO better if you run it through IDLE or whatever you use. (I golfed it down to 424 bytes after, but I'm sure you lot can do better).







code-golf string interpreter






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 1 hour ago







Artemis Fowl

















asked 4 hours ago









Artemis FowlArtemis Fowl

2119




2119







  • 1




    $begingroup$
    Allowing input to already be in a variable is non-standard, as is allowing output to be in one.
    $endgroup$
    – Jonathan Allan
    3 hours ago











  • $begingroup$
    Are we allowed to take in a generator function instead of an array/list for the input?
    $endgroup$
    – Embodiment of Ignorance
    2 hours ago











  • $begingroup$
    Also, for <, if our answer is a function that returns a value, should I print in the middle of the function and return the final string?
    $endgroup$
    – Embodiment of Ignorance
    2 hours ago










  • $begingroup$
    @EmbodimentofIgnorance RE - Generator: No, it was and is stated in my question that it is the next line of stdin. RE - <: I have clarified in my question that it must print to stdout, except the final value.
    $endgroup$
    – Artemis Fowl
    2 hours ago










  • $begingroup$
    @JonathanAllan Question clarified.
    $endgroup$
    – Artemis Fowl
    2 hours ago












  • 1




    $begingroup$
    Allowing input to already be in a variable is non-standard, as is allowing output to be in one.
    $endgroup$
    – Jonathan Allan
    3 hours ago











  • $begingroup$
    Are we allowed to take in a generator function instead of an array/list for the input?
    $endgroup$
    – Embodiment of Ignorance
    2 hours ago











  • $begingroup$
    Also, for <, if our answer is a function that returns a value, should I print in the middle of the function and return the final string?
    $endgroup$
    – Embodiment of Ignorance
    2 hours ago










  • $begingroup$
    @EmbodimentofIgnorance RE - Generator: No, it was and is stated in my question that it is the next line of stdin. RE - <: I have clarified in my question that it must print to stdout, except the final value.
    $endgroup$
    – Artemis Fowl
    2 hours ago










  • $begingroup$
    @JonathanAllan Question clarified.
    $endgroup$
    – Artemis Fowl
    2 hours ago







1




1




$begingroup$
Allowing input to already be in a variable is non-standard, as is allowing output to be in one.
$endgroup$
– Jonathan Allan
3 hours ago





$begingroup$
Allowing input to already be in a variable is non-standard, as is allowing output to be in one.
$endgroup$
– Jonathan Allan
3 hours ago













$begingroup$
Are we allowed to take in a generator function instead of an array/list for the input?
$endgroup$
– Embodiment of Ignorance
2 hours ago





$begingroup$
Are we allowed to take in a generator function instead of an array/list for the input?
$endgroup$
– Embodiment of Ignorance
2 hours ago













$begingroup$
Also, for <, if our answer is a function that returns a value, should I print in the middle of the function and return the final string?
$endgroup$
– Embodiment of Ignorance
2 hours ago




$begingroup$
Also, for <, if our answer is a function that returns a value, should I print in the middle of the function and return the final string?
$endgroup$
– Embodiment of Ignorance
2 hours ago












$begingroup$
@EmbodimentofIgnorance RE - Generator: No, it was and is stated in my question that it is the next line of stdin. RE - <: I have clarified in my question that it must print to stdout, except the final value.
$endgroup$
– Artemis Fowl
2 hours ago




$begingroup$
@EmbodimentofIgnorance RE - Generator: No, it was and is stated in my question that it is the next line of stdin. RE - <: I have clarified in my question that it must print to stdout, except the final value.
$endgroup$
– Artemis Fowl
2 hours ago












$begingroup$
@JonathanAllan Question clarified.
$endgroup$
– Artemis Fowl
2 hours ago




$begingroup$
@JonathanAllan Question clarified.
$endgroup$
– Artemis Fowl
2 hours ago










2 Answers
2






active

oldest

votes


















1












$begingroup$


C# (Visual C# Interactive Compiler), 305 bytes





a=>'))g=$"c,2";d=g[1]==62?ReadLine():g.Substring(2);var z=c[0]%14;s=z<1?string.Concat(Enumerable.Repeat(s,int.Parse(d))):z<2?s+d:z<4?s.Replace(d,""):z<5?s:z<6?string.Concat(s.Reverse()):string.Concat(s.OrderBy(_=>Guid.NewGuid()));Write(z==4?s:"");return s;


Try it online!






share|improve this answer











$endgroup$












  • $begingroup$
    What's that in the TIO input section? Your code seems to operate the same without it... [Utterly new to C#]
    $endgroup$
    – Artemis Fowl
    1 hour ago










  • $begingroup$
    @ArtemisFowl Those were some notes I were writing, forgot to delete. Deleted now
    $endgroup$
    – Embodiment of Ignorance
    1 hour ago











  • $begingroup$
    As specified by the question (12 mins before your answer was posted), input other than the program should be taken from stdin.
    $endgroup$
    – Artemis Fowl
    1 hour ago










  • $begingroup$
    @ArtemisFowl Fixed, and saved some bytes
    $endgroup$
    – Embodiment of Ignorance
    1 hour ago


















1












$begingroup$


Python 2, 215 219 bytes





from random import*
I=raw_input;o=''
for t in I().split('|'):p=t[1:]=='>'and I()or t[2:];exec dict(zip("!$<+-*","o=o[::-1];o=''.join(sample(o,len(o)));print o;o+=p;o=o.replace(p,'');o*=int(p)".split(';')))[t[0]]
print o


Try it online!



-4 because raw_input is required.






share|improve this answer











$endgroup$












  • $begingroup$
    Input other than the program must be from stdin, as specified in the question.
    $endgroup$
    – Artemis Fowl
    36 mins ago










  • $begingroup$
    For ease of TIO usage, I'm mocking 'input()' with the function 'Input()' - same number of chars and behavior. Is this not equivalent? Is it better if I don't capitalize, as I have now amended?
    $endgroup$
    – Chas Brown
    34 mins ago











  • $begingroup$
    I use Python 3, but as far as I was aware, that usage of input requires raw_input. Correct me if I am wrong..
    $endgroup$
    – Artemis Fowl
    32 mins ago










  • $begingroup$
    To my knowledge, here at PPCG / TIO, input() is fine for stdin in 2.7; I'll see if I can find the relevant Meta posting...
    $endgroup$
    – Chas Brown
    30 mins ago










  • $begingroup$
    According to Py 2.7 docs: input([prompt]) Equivalent to eval(raw_input(prompt)). This function does not catch user errors. If the input is not syntactically valid, a SyntaxError will be raised.
    $endgroup$
    – Artemis Fowl
    26 mins ago











Your Answer





StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
);
);
, "mathjax-editing");

StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "200"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f182764%2fstring-manipulation-interpreter%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









1












$begingroup$


C# (Visual C# Interactive Compiler), 305 bytes





a=>'))g=$"c,2";d=g[1]==62?ReadLine():g.Substring(2);var z=c[0]%14;s=z<1?string.Concat(Enumerable.Repeat(s,int.Parse(d))):z<2?s+d:z<4?s.Replace(d,""):z<5?s:z<6?string.Concat(s.Reverse()):string.Concat(s.OrderBy(_=>Guid.NewGuid()));Write(z==4?s:"");return s;


Try it online!






share|improve this answer











$endgroup$












  • $begingroup$
    What's that in the TIO input section? Your code seems to operate the same without it... [Utterly new to C#]
    $endgroup$
    – Artemis Fowl
    1 hour ago










  • $begingroup$
    @ArtemisFowl Those were some notes I were writing, forgot to delete. Deleted now
    $endgroup$
    – Embodiment of Ignorance
    1 hour ago











  • $begingroup$
    As specified by the question (12 mins before your answer was posted), input other than the program should be taken from stdin.
    $endgroup$
    – Artemis Fowl
    1 hour ago










  • $begingroup$
    @ArtemisFowl Fixed, and saved some bytes
    $endgroup$
    – Embodiment of Ignorance
    1 hour ago















1












$begingroup$


C# (Visual C# Interactive Compiler), 305 bytes





a=>'))g=$"c,2";d=g[1]==62?ReadLine():g.Substring(2);var z=c[0]%14;s=z<1?string.Concat(Enumerable.Repeat(s,int.Parse(d))):z<2?s+d:z<4?s.Replace(d,""):z<5?s:z<6?string.Concat(s.Reverse()):string.Concat(s.OrderBy(_=>Guid.NewGuid()));Write(z==4?s:"");return s;


Try it online!






share|improve this answer











$endgroup$












  • $begingroup$
    What's that in the TIO input section? Your code seems to operate the same without it... [Utterly new to C#]
    $endgroup$
    – Artemis Fowl
    1 hour ago










  • $begingroup$
    @ArtemisFowl Those were some notes I were writing, forgot to delete. Deleted now
    $endgroup$
    – Embodiment of Ignorance
    1 hour ago











  • $begingroup$
    As specified by the question (12 mins before your answer was posted), input other than the program should be taken from stdin.
    $endgroup$
    – Artemis Fowl
    1 hour ago










  • $begingroup$
    @ArtemisFowl Fixed, and saved some bytes
    $endgroup$
    – Embodiment of Ignorance
    1 hour ago













1












1








1





$begingroup$


C# (Visual C# Interactive Compiler), 305 bytes





a=>'))g=$"c,2";d=g[1]==62?ReadLine():g.Substring(2);var z=c[0]%14;s=z<1?string.Concat(Enumerable.Repeat(s,int.Parse(d))):z<2?s+d:z<4?s.Replace(d,""):z<5?s:z<6?string.Concat(s.Reverse()):string.Concat(s.OrderBy(_=>Guid.NewGuid()));Write(z==4?s:"");return s;


Try it online!






share|improve this answer











$endgroup$




C# (Visual C# Interactive Compiler), 305 bytes





a=>'))g=$"c,2";d=g[1]==62?ReadLine():g.Substring(2);var z=c[0]%14;s=z<1?string.Concat(Enumerable.Repeat(s,int.Parse(d))):z<2?s+d:z<4?s.Replace(d,""):z<5?s:z<6?string.Concat(s.Reverse()):string.Concat(s.OrderBy(_=>Guid.NewGuid()));Write(z==4?s:"");return s;


Try it online!







share|improve this answer














share|improve this answer



share|improve this answer








edited 45 mins ago

























answered 1 hour ago









Embodiment of IgnoranceEmbodiment of Ignorance

2,778127




2,778127











  • $begingroup$
    What's that in the TIO input section? Your code seems to operate the same without it... [Utterly new to C#]
    $endgroup$
    – Artemis Fowl
    1 hour ago










  • $begingroup$
    @ArtemisFowl Those were some notes I were writing, forgot to delete. Deleted now
    $endgroup$
    – Embodiment of Ignorance
    1 hour ago











  • $begingroup$
    As specified by the question (12 mins before your answer was posted), input other than the program should be taken from stdin.
    $endgroup$
    – Artemis Fowl
    1 hour ago










  • $begingroup$
    @ArtemisFowl Fixed, and saved some bytes
    $endgroup$
    – Embodiment of Ignorance
    1 hour ago
















  • $begingroup$
    What's that in the TIO input section? Your code seems to operate the same without it... [Utterly new to C#]
    $endgroup$
    – Artemis Fowl
    1 hour ago










  • $begingroup$
    @ArtemisFowl Those were some notes I were writing, forgot to delete. Deleted now
    $endgroup$
    – Embodiment of Ignorance
    1 hour ago











  • $begingroup$
    As specified by the question (12 mins before your answer was posted), input other than the program should be taken from stdin.
    $endgroup$
    – Artemis Fowl
    1 hour ago










  • $begingroup$
    @ArtemisFowl Fixed, and saved some bytes
    $endgroup$
    – Embodiment of Ignorance
    1 hour ago















$begingroup$
What's that in the TIO input section? Your code seems to operate the same without it... [Utterly new to C#]
$endgroup$
– Artemis Fowl
1 hour ago




$begingroup$
What's that in the TIO input section? Your code seems to operate the same without it... [Utterly new to C#]
$endgroup$
– Artemis Fowl
1 hour ago












$begingroup$
@ArtemisFowl Those were some notes I were writing, forgot to delete. Deleted now
$endgroup$
– Embodiment of Ignorance
1 hour ago





$begingroup$
@ArtemisFowl Those were some notes I were writing, forgot to delete. Deleted now
$endgroup$
– Embodiment of Ignorance
1 hour ago













$begingroup$
As specified by the question (12 mins before your answer was posted), input other than the program should be taken from stdin.
$endgroup$
– Artemis Fowl
1 hour ago




$begingroup$
As specified by the question (12 mins before your answer was posted), input other than the program should be taken from stdin.
$endgroup$
– Artemis Fowl
1 hour ago












$begingroup$
@ArtemisFowl Fixed, and saved some bytes
$endgroup$
– Embodiment of Ignorance
1 hour ago




$begingroup$
@ArtemisFowl Fixed, and saved some bytes
$endgroup$
– Embodiment of Ignorance
1 hour ago











1












$begingroup$


Python 2, 215 219 bytes





from random import*
I=raw_input;o=''
for t in I().split('|'):p=t[1:]=='>'and I()or t[2:];exec dict(zip("!$<+-*","o=o[::-1];o=''.join(sample(o,len(o)));print o;o+=p;o=o.replace(p,'');o*=int(p)".split(';')))[t[0]]
print o


Try it online!



-4 because raw_input is required.






share|improve this answer











$endgroup$












  • $begingroup$
    Input other than the program must be from stdin, as specified in the question.
    $endgroup$
    – Artemis Fowl
    36 mins ago










  • $begingroup$
    For ease of TIO usage, I'm mocking 'input()' with the function 'Input()' - same number of chars and behavior. Is this not equivalent? Is it better if I don't capitalize, as I have now amended?
    $endgroup$
    – Chas Brown
    34 mins ago











  • $begingroup$
    I use Python 3, but as far as I was aware, that usage of input requires raw_input. Correct me if I am wrong..
    $endgroup$
    – Artemis Fowl
    32 mins ago










  • $begingroup$
    To my knowledge, here at PPCG / TIO, input() is fine for stdin in 2.7; I'll see if I can find the relevant Meta posting...
    $endgroup$
    – Chas Brown
    30 mins ago










  • $begingroup$
    According to Py 2.7 docs: input([prompt]) Equivalent to eval(raw_input(prompt)). This function does not catch user errors. If the input is not syntactically valid, a SyntaxError will be raised.
    $endgroup$
    – Artemis Fowl
    26 mins ago















1












$begingroup$


Python 2, 215 219 bytes





from random import*
I=raw_input;o=''
for t in I().split('|'):p=t[1:]=='>'and I()or t[2:];exec dict(zip("!$<+-*","o=o[::-1];o=''.join(sample(o,len(o)));print o;o+=p;o=o.replace(p,'');o*=int(p)".split(';')))[t[0]]
print o


Try it online!



-4 because raw_input is required.






share|improve this answer











$endgroup$












  • $begingroup$
    Input other than the program must be from stdin, as specified in the question.
    $endgroup$
    – Artemis Fowl
    36 mins ago










  • $begingroup$
    For ease of TIO usage, I'm mocking 'input()' with the function 'Input()' - same number of chars and behavior. Is this not equivalent? Is it better if I don't capitalize, as I have now amended?
    $endgroup$
    – Chas Brown
    34 mins ago











  • $begingroup$
    I use Python 3, but as far as I was aware, that usage of input requires raw_input. Correct me if I am wrong..
    $endgroup$
    – Artemis Fowl
    32 mins ago










  • $begingroup$
    To my knowledge, here at PPCG / TIO, input() is fine for stdin in 2.7; I'll see if I can find the relevant Meta posting...
    $endgroup$
    – Chas Brown
    30 mins ago










  • $begingroup$
    According to Py 2.7 docs: input([prompt]) Equivalent to eval(raw_input(prompt)). This function does not catch user errors. If the input is not syntactically valid, a SyntaxError will be raised.
    $endgroup$
    – Artemis Fowl
    26 mins ago













1












1








1





$begingroup$


Python 2, 215 219 bytes





from random import*
I=raw_input;o=''
for t in I().split('|'):p=t[1:]=='>'and I()or t[2:];exec dict(zip("!$<+-*","o=o[::-1];o=''.join(sample(o,len(o)));print o;o+=p;o=o.replace(p,'');o*=int(p)".split(';')))[t[0]]
print o


Try it online!



-4 because raw_input is required.






share|improve this answer











$endgroup$




Python 2, 215 219 bytes





from random import*
I=raw_input;o=''
for t in I().split('|'):p=t[1:]=='>'and I()or t[2:];exec dict(zip("!$<+-*","o=o[::-1];o=''.join(sample(o,len(o)));print o;o+=p;o=o.replace(p,'');o*=int(p)".split(';')))[t[0]]
print o


Try it online!



-4 because raw_input is required.







share|improve this answer














share|improve this answer



share|improve this answer








edited 11 mins ago

























answered 41 mins ago









Chas BrownChas Brown

5,1591523




5,1591523











  • $begingroup$
    Input other than the program must be from stdin, as specified in the question.
    $endgroup$
    – Artemis Fowl
    36 mins ago










  • $begingroup$
    For ease of TIO usage, I'm mocking 'input()' with the function 'Input()' - same number of chars and behavior. Is this not equivalent? Is it better if I don't capitalize, as I have now amended?
    $endgroup$
    – Chas Brown
    34 mins ago











  • $begingroup$
    I use Python 3, but as far as I was aware, that usage of input requires raw_input. Correct me if I am wrong..
    $endgroup$
    – Artemis Fowl
    32 mins ago










  • $begingroup$
    To my knowledge, here at PPCG / TIO, input() is fine for stdin in 2.7; I'll see if I can find the relevant Meta posting...
    $endgroup$
    – Chas Brown
    30 mins ago










  • $begingroup$
    According to Py 2.7 docs: input([prompt]) Equivalent to eval(raw_input(prompt)). This function does not catch user errors. If the input is not syntactically valid, a SyntaxError will be raised.
    $endgroup$
    – Artemis Fowl
    26 mins ago
















  • $begingroup$
    Input other than the program must be from stdin, as specified in the question.
    $endgroup$
    – Artemis Fowl
    36 mins ago










  • $begingroup$
    For ease of TIO usage, I'm mocking 'input()' with the function 'Input()' - same number of chars and behavior. Is this not equivalent? Is it better if I don't capitalize, as I have now amended?
    $endgroup$
    – Chas Brown
    34 mins ago











  • $begingroup$
    I use Python 3, but as far as I was aware, that usage of input requires raw_input. Correct me if I am wrong..
    $endgroup$
    – Artemis Fowl
    32 mins ago










  • $begingroup$
    To my knowledge, here at PPCG / TIO, input() is fine for stdin in 2.7; I'll see if I can find the relevant Meta posting...
    $endgroup$
    – Chas Brown
    30 mins ago










  • $begingroup$
    According to Py 2.7 docs: input([prompt]) Equivalent to eval(raw_input(prompt)). This function does not catch user errors. If the input is not syntactically valid, a SyntaxError will be raised.
    $endgroup$
    – Artemis Fowl
    26 mins ago















$begingroup$
Input other than the program must be from stdin, as specified in the question.
$endgroup$
– Artemis Fowl
36 mins ago




$begingroup$
Input other than the program must be from stdin, as specified in the question.
$endgroup$
– Artemis Fowl
36 mins ago












$begingroup$
For ease of TIO usage, I'm mocking 'input()' with the function 'Input()' - same number of chars and behavior. Is this not equivalent? Is it better if I don't capitalize, as I have now amended?
$endgroup$
– Chas Brown
34 mins ago





$begingroup$
For ease of TIO usage, I'm mocking 'input()' with the function 'Input()' - same number of chars and behavior. Is this not equivalent? Is it better if I don't capitalize, as I have now amended?
$endgroup$
– Chas Brown
34 mins ago













$begingroup$
I use Python 3, but as far as I was aware, that usage of input requires raw_input. Correct me if I am wrong..
$endgroup$
– Artemis Fowl
32 mins ago




$begingroup$
I use Python 3, but as far as I was aware, that usage of input requires raw_input. Correct me if I am wrong..
$endgroup$
– Artemis Fowl
32 mins ago












$begingroup$
To my knowledge, here at PPCG / TIO, input() is fine for stdin in 2.7; I'll see if I can find the relevant Meta posting...
$endgroup$
– Chas Brown
30 mins ago




$begingroup$
To my knowledge, here at PPCG / TIO, input() is fine for stdin in 2.7; I'll see if I can find the relevant Meta posting...
$endgroup$
– Chas Brown
30 mins ago












$begingroup$
According to Py 2.7 docs: input([prompt]) Equivalent to eval(raw_input(prompt)). This function does not catch user errors. If the input is not syntactically valid, a SyntaxError will be raised.
$endgroup$
– Artemis Fowl
26 mins ago




$begingroup$
According to Py 2.7 docs: input([prompt]) Equivalent to eval(raw_input(prompt)). This function does not catch user errors. If the input is not syntactically valid, a SyntaxError will be raised.
$endgroup$
– Artemis Fowl
26 mins ago

















draft saved

draft discarded
















































If this is an answer to a challenge…



  • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


  • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
    Explanations of your answer make it more interesting to read and are very much encouraged.


  • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.


More generally…



  • …Please make sure to answer the question and provide sufficient detail.


  • …Avoid asking for help, clarification or responding to other answers (use comments instead).




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f182764%2fstring-manipulation-interpreter%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Are there any AGPL-style licences that require source code modifications to be public? Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Force derivative works to be publicAre there any GPL like licenses for Apple App Store?Do you violate the GPL if you provide source code that cannot be compiled?GPL - is it distribution to use libraries in an appliance loaned to customers?Distributing App for free which uses GPL'ed codeModifications of server software under GPL, with web/CLI interfaceDoes using an AGPLv3-licensed library prevent me from dual-licensing my own source code?Can I publish only select code under GPLv3 from a private project?Is there published precedent regarding the scope of covered work that uses AGPL software?If MIT licensed code links to GPL licensed code what should be the license of the resulting binary program?If I use a public API endpoint that has its source code licensed under AGPL in my app, do I need to disclose my source?

2013 GY136 Descoberta | Órbita | Referências Menu de navegação«List Of Centaurs and Scattered-Disk Objects»«List of Known Trans-Neptunian Objects»

Button changing it's text & action. Good or terrible? The 2019 Stack Overflow Developer Survey Results Are Inchanging text on user mouseoverShould certain functions be “hard to find” for powerusers to discover?Custom liking function - do I need user login?Using different checkbox style for different checkbox behaviorBest Practices: Save and Exit in Software UIInteraction with remote validated formMore efficient UI to progress the user through a complicated process?Designing a popup notice for a gameShould bulk-editing functions be hidden until a table row is selected, or is there a better solution?Is it bad practice to disable (replace) the context menu?