# Are languages like sed exempt from “no input” rules?

Some types of challenges require submission that produce constant output and, as such, forbid the solutions from taking input of any kind.

That presents a problem for languages like sed, which execute code for each line of input, so they downright refuse to do anything if STDIN is empty.

On one hand, if we apply the same rules to all languages, sed simply won't be allowed to compete. On the other hand, excluding a language altogether seems undesirable.

So:

• Should a language that requires input to do anything be allowed to take input, even if all other languages are not?

• What should that input be?

• What should happen in cases like this one, where an exemption from the rule would simplify the task at hand?

• Might it be possible to require that the program runs correctly for any single-line input? – xnor Jun 24 '15 at 19:59
• This makes me wonder what "no input" means. Does it mean the program has to work the same regardless of what is given on STDIN or does it mean you have to assume STDIN is empty? – Martin Ender Jun 25 '15 at 21:00
• @MartinBüttner: That's a good point.With the first interpretation, I'd have to revise a few GolfScript answers... – Dennis Jun 25 '15 at 21:03
• that input should be any possible input in order to verify it's not based on input I think. – Erik the Outgolfer Sep 4 '16 at 20:44
• @Eʀɪᴋ Current consensus is that programs may assume that input is empty – Dennis Sep 4 '16 at 20:55
• @Dennis Of course, you can't do that in sed, that's the point of the question! So, different inputs will verify if a submission is actually input-independent. – Erik the Outgolfer Sep 4 '16 at 20:57
• @Eʀɪᴋ That contradicts both the consensus reached in this discussion and the one I linked to. If you want to propose something different, make your case in an answer. – Dennis Sep 4 '16 at 21:01
• @Dennis Unfortunately, it's nighttime where I am, so I'm not in mood of changing consensuses. – Erik the Outgolfer Sep 4 '16 at 21:14

# Yes, as long as the exact input for this language is proposed before the question

Because this is basically the same as inventing a dialect of the original language.

For sed, I propose an empty line. And the interpreter in bash is:

#!/bin/bash
echo|sed "$@"  Or a more complex one: #!/bin/bash if ! [ -t 0 ] || [ "$(head -c1|tee /dev/fd/3|wc -c)" = 0 ]; then echo; else cat; fi 3>&1|sed "$@"  I consider these non-standard sed language interpreters, instead of a new language. (If you agree with me, the sed variant doesn't need to be the consensus to be valid. If you don't, you can propose this sed variant again in another answer. So don't vote for the above code.) • I am unclear on the definition of "purpose" you're using here. – Sparr Jun 24 '15 at 17:21 • @Sparr Sorry for my bad English... – jimmy23013 Jun 24 '15 at 17:25 • Upvoted for the idea. Another alternative could be an interpreter such as [ -t 0 ] && echo || cat | sed "$@", which wouldn't require any input at all, not even an empty one. – Dennis Jun 24 '15 at 17:33
• @Dennis Edited into my second version. – jimmy23013 Jun 24 '15 at 17:38
• I agree with the "empty input" suggestion. – SuperJedi224 Jun 29 '15 at 15:44
• Another way to start it is sed -f script_file <<< "", which I use on both "no input" rule challenges (given this exempt) and on those stating that the code must be a complete program, showing how to run it straight forward, without the need of echo. – seshoumara Sep 1 '16 at 15:49
• @seshoumara That's not an empty input - it's an input of a newline. sed -f script_file < /dev/null or echo -n | sed -f script_file are better alternatives because both are truly empty inputs - no newlines. – user45941 Sep 1 '16 at 21:08
• @Mego I didn't say sed receives an empty input, I said I use it for those types of challenges based on this exempt discussed here. My snippet is actually equivalent to echo|sed as accepted in this answer. If the input was truly empty a sed code wont execute, the topic discusses what an input should be that can be used in no input challenges. – seshoumara Sep 1 '16 at 21:13