Print every character your program doesn't have

  • Your task is to build a program (using only printable ASCII characters and/or tabs and newlines) that prints out exactly the characters in the printable ASCII space (0x20 to 0x7e) that don't appear in your program's source code (in any order, however many times you want).

    The shortest code to do this in any language wins.

    tabs and newlines *are* printable ASCII characters.

    They are, but they're not in the range `0x20` to `0x7e`, which are defined as the "printable ASCII characters". Technically tabs and newlines are actually control characters.

    Are we allowed to print newlines (or any other unprintable ASCII characters)?

    Tabs and newlines do not render in such a way that they occupy a printing position. They move the position. See the ANSI C "isprint" function.

    What is the universal set, whose subset you ask to negate? I also do not understand were is the self-reference in all those answers.

    @Val agreed, so far most answers just explicitly print out characters, rather than referring back to the original file.

    @LegoStormtroopr The program doesn't have to actually refer to its own source code. It just needed to, as I said, print out exactly those characters its source code doesn't have.

    How did this question get revived? It's started getting upvotes again.

    Ah, I see. It was posted on Hacker News.

    I’m disappointed that you decided to restrict this to ASCII-based languages only. Otherwise `글⓵돠上字終` would have been a valid 6-character solution in Sclipting. It outputs all the ASCII characters and doesn’t have any of them in its source.

    @Timwi: If you wanted to do that, you'd have to output all the characters in the CJK character space too (excluding the ones appearing in your code). It's too complicated to manage, so I restricted it to just ASCII.

    "The shortest code to do this in any language wins." is unclear. Do you mean there is a single winner, over all languages? Or do you mean there's a winner per language?

    Can we output non-ASCII characters as well?

    @cairdcoinheringaahing I interpret as only print printable ASCII characters or (tabs and newlines)

    Does it means writing a program contains all printable ascii as comment (or non-functional codes) and print nothing is valid? If so, any language who support comments should be able to do this in <100bytes.

  • Howard

    Howard Correct answer

    8 years ago

    GolfScript, 15 12 characters


    Based on Jan Dvorak's answer with a few twists and also in the style of Peter Taylor's one.

License under CC-BY-SA with attribution

Content dated before 7/24/2021 11:53 AM