# Pristine Polyglots

As the title says, you are to create a pristine program in as many languages as possible. A pristine program, taken from here, is:

Let's define a pristine program as a program that does not have any errors itself but will error if you modify it by removing any contiguous substring of $$\N\$$ characters, where $$\1 \le N < \text{program length}\$$.

For example, the three character Python 2 program

8


is a pristine program (thanks, Sp) because all the programs resulting from removing substrings of length 1 cause errors (syntax errors in fact, but any type of error will do):

8

8


and also all the programs resulting from removing substrings of length 2 cause errors:





If, for example, 8 had been a non-erroring program then 8 would not be pristine because all the results of substring removal must error.

You are to write, in as many languages as possible, a pristine program.

• Your program must produce a non-empty output when unaltered.

• This output can be anything you like, can vary depending on different inputs, or anything else, so long as, when run, unaltered and with no/empty input, it produces a non-empty output (note that 0, or your language's null value is non-empty).

• The output may not be to STDERR (or your language's equivalent), as this would fall under the definition of an "erroring program" below.

• The output does not have to consistent across languages, or when executed twice in the same language.

• Your code must work in a minimum of two distinct languages and must be at least 2 bytes long

• Different versions of a language do not count as different languages. Therefore, Python 2 and Python 3 are considered the same language.

• Your program must be pristine in all languages used

• An error is defined as anything that causes the program to either entirely fail to run or to terminate with a nonzero exit code after a finite amount of time.

• This is , so the answer with the most languages wins

• In case of a tie breaker, the longest solution, in bytes, wins

I would also be interested in proofs of impossibility for certain pairs/groups of languages. If you find a particularly interesting proof, please leave it in the comments (or, preferably, a link to the full write up), and I'll invite you to post as an answer so I can award it a bounty if I agree that its especially interesting. Please do not post these proofs unless I have said I will award it a bounty, I don't want all the answers to be filled by such proofs and actual answers be buried. Proofs posted without me asking you to will not be considered valid

• Sandbox – caird coinheringaahing Sep 30 '20 at 12:22
• Does a warning such as a PHP warning count 1. as an error? 2. if not, as an output? (PHP warnings when enabled are displayed in the output) – Kaddath Sep 30 '20 at 12:22
• @Kaddath I'll go by the original definition of pristine programs, and say that warnings (for all languages) don't count as errors. If the warnings are naturally piped to STDOUT (or nearest equivalent), then I think that counts as output – caird coinheringaahing Sep 30 '20 at 12:25
• @user the proofs are completely subjective. I‘m not surprised that there‘s certain conditions where it becomes trivial, I‘m more interested in non-trivial examples (say Python, C and Java). Ultimately, the proof bit is 100% subjective, and is only there to provide a reward for people who may have decided to do it in a group of languages, which then they prove are impossible, especially if the group of languages is non-trivial to prove impossible – caird coinheringaahing Sep 30 '20 at 16:36
• @Jonah I'll be both permissive and strict (to my own rules), and say, yes a newline is nonempty, as it outputs a specific character (even if we can't "see" that character). The same applies to a space character, and any other whitespace – caird coinheringaahing Oct 1 '20 at 1:01

# 6 languages

## Bash, 4 bytes

echo


Try it online!

## Zsh, 4 bytes

echo


Try it online!

## fish, 4 bytes

echo


Try it online!

## tcsh, 4 bytes

echo


Try it online!

## ksh, 4 bytes

echo


Try it online!

## J, 4 bytes

echo


Try it online!

Kicking things off with a boring one. If I understand the rules, I think it's legal though.

The shells are clear enough and output a newline. Removing any contiguous substring will result in "command not found".

In J, echo is a built in function, and prints its argument with a newline appended. J doesn't have 0-argument functions, so you have to call it with something. However, anything works, including the empty string '', which is the conventional choice for calling a function when the argument doesn't matter.

• I'm not surprised that such a trivial solution exists, and, if I understand the TIO links correctly, this is a perfectly valid answer. I'd be interested to see how many languages this can be extended to though. From my understanding, a lot of the shell languages (zsh, etc.) are pretty similar to Bash, so it might be fairly easy to add more languages – caird coinheringaahing Oct 1 '20 at 1:19
• Yeah I was thinking the same. I'll try to find some others. I'm sure others will point them out too. – Jonah Oct 1 '20 at 1:21
• Others: ash, dash, sh, mksh, osh, xonsh, yash, php -r :) – Dom Hastings Oct 1 '20 at 11:08
• You forgot the totally forgettable csh. – Noodle9 Oct 1 '20 at 12:36
• @DomHastings I think that for PHP it requires a param and a ; I tried to elaborate and answer based on print` and the required param caused me a problem (as it was not required in the other languages I wanted to use) – Kaddath Oct 1 '20 at 13:55