Print every character your program doesn't have

221

51

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.

Joe Z.

Posted 2013-08-23T16:04:35.923

Reputation: 30 589

"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? – Don Hatch – 2015-10-03T21:57:49.900

tabs and newlines are printable ASCII characters. – Bakuriu – 2013-08-23T18:49:42.060

19They 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. – Joe Z. – 2013-08-23T19:22:57.300

3Are we allowed to print newlines (or any other unprintable ASCII characters)? – flornquake – 2013-08-24T00:30:30.740

1Tabs 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. – Kaz – 2013-08-24T02:00:48.233

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 – 2013-08-24T10:50:03.000

@Val agreed, so far most answers just explicitly print out characters, rather than referring back to the original file. – None – 2013-08-24T22:45:46.957

@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. – Joe Z. – 2013-08-24T23:31:52.383

1Can we output non-ASCII characters as well? – caird coinheringaahing – 2017-11-23T16:19:48.610

1How did this question get revived? It's started getting upvotes again. – Joe Z. – 2014-01-31T16:38:00.540

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

– Joe Z. – 2014-01-31T19:45:55.710

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 – 2014-01-31T22:46:23.963

3@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. – Joe Z. – 2014-02-01T03:01:29.007

@cairdcoinheringaahing I interpret as only print printable ASCII characters or (tabs and newlines) – qwr – 2018-06-20T19:21:57.037

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. – tsh – 2019-10-16T02:22:20.830

Answers

53

GolfScript, 15 12 characters

{`),32>^.}.~

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

Howard

Posted 2013-08-23T16:04:35.923

Reputation: 23 109

275

Polyglot, 95

#undef X;A!"$%&'()*+-[,.]/0123456789:<=>?@BCDEFGHIJKLMNOPQRSTUVWYZ\^_`abcghijklmopqrstvwxyz{|}~

Does nothing.

Johannes Kuhn

Posted 2013-08-23T16:04:35.923

Reputation: 7 122

If an extra " is added at the end, it also works in Mathematica. – LegionMammal978 – 2015-11-18T22:31:54.060

Yes, but can you make it shorter? – Joe Z. – 2013-08-23T16:21:53.277

19No, but this is a polygot. I don't want to destroy that. – Johannes Kuhn – 2013-08-23T16:26:19.547

4If you put the [] on the outside it will "work" in brainfuck too. – marinus – 2013-08-23T16:28:20.600

No. I have an output (.) in it. Wait... – Johannes Kuhn – 2013-08-23T16:31:02.727

Well, I have to skip the output (.) and input (,) so it will do nothing in brainfuck. – Johannes Kuhn – 2013-08-23T16:32:49.093

1@JohannesKuhn: that's what I meant by putting [] on the outside. – marinus – 2013-08-23T16:35:44.933

@marinus it suffices to put it after the hash – John Dvorak – 2013-08-23T16:36:53.020

This will do weird stuff in C/C++ – John Dvorak – 2013-08-23T16:38:02.290

1C/C++ is not on the list (a comment would require // or /* */) – Johannes Kuhn – 2013-08-23T16:39:40.910

95I fed this into the GNU Fortran compiler and it segfaulted. – marinus – 2013-08-23T16:43:36.193

2Count Ruby as one where this works. Also, coffeescript (I think) – John Dvorak – 2013-08-23T16:50:05.433

12In C, #undef X;whatever junk you want works. – ugoren – 2013-08-23T16:56:52.563

1@ugoren: No it won't, you need to define a main() function or it will not compile. – marinus – 2013-08-23T17:09:29.667

@ Johannes Kuhn: It wasn't a polyglot when I first saw it. (Tcl only at first :P) But now I see what you mean. – Joe Z. – 2013-08-23T17:09:45.970

1also, count in golfscript – John Dvorak – 2013-08-23T17:11:32.700

6Works in Python too (because it uses # for comments like Ruby and Perl) – Doorknob – 2013-08-23T17:15:13.043

@marinus, You're right. The line itself comiles, but it isn't enough. – ugoren – 2013-08-23T17:59:40.223

89"The shortest code to do this in any language wins." For the lack of a code that works in any language, this entry should win, since it's the code that works in the greatest number of languages. ;-D – msb – 2013-08-27T23:33:17.983

1@msb By "any" language, I mean "the language of your choice". – Joe Z. – 2013-09-01T05:00:31.160

6@JoeZ. I know, just kidding, trying to bend the interpretation of the definition to favour the most creative answer IMO. ;-) – msb – 2013-09-04T00:27:18.750

1Works in PowerShell. – Iszi – 2013-11-23T05:47:28.707

1I believe this should be made into a community-wiki – user41805 – 2017-04-23T16:16:10.213

1Works with ><>. If you move the @ to somewhere before the ,, it also works in Befunge-93. No way to make it work with 98 – Jo King – 2018-01-12T01:52:55.893

Is it as polygot or a polyg_l_ot? – A.L – 2014-03-27T15:02:22.540

2@msb, the OP would have said *The shortest code to do this in every language wins.* – Paul Draper – 2014-04-11T05:39:55.937

q/k version is / !"#$%&'()*+,-.0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ – Aaron Davies – 2014-05-05T17:08:06.357

How is this valid BF? Extracting out only the BF instructions, we get [,.] which infinitly prompts for input and outputs it. So, if I input A, it will print A and then ask again. However, your code contains an A. Or am I missing something here? – Cole Johnson – 2014-05-16T16:52:58.673

5but only if the current pos is not 0 at this point. – Johannes Kuhn – 2014-05-17T06:20:36.120

145

PHP 5.2, 4

<?<<

Save as a file called NYUIOMK()'DEAQRWVX[Z]\^@CBGFJqwv{z}|~`bgfkj203547698;=>!#"%$&+*-.php somewhere in /home. short_open_tag needs to be On in your php.ini.

The output is:

PHP Parse error:  syntax error, unexpected T_SL in /home/wherever/NYUIOMK()'DEAQRWVX[Z]\^@CBGFJqwv{z}|~`bgfkj203547698;=>!#"%$&+*-.php on line 1

Ry-

Posted 2013-08-23T16:04:35.923

Reputation: 5 283

42Haha, nice bending of the rules. – Johannes Kuhn – 2013-08-27T19:12:12.727

Mind telling us how it works? – Joe Z. – 2013-08-27T19:16:12.733

1Is it something to do with the "paamayim nekudotayim" (::) operator? :P – Doorknob – 2013-08-27T21:23:22.313

@JoeZ.: Sure, see output. – Ry- – 2013-08-27T22:32:50.913

6Nice, but unfortunately I can spot a : in the output. – Howard – 2013-08-28T04:57:58.570

I considered doing something similar with bash, but didn't because I thought it was too obvious to be interesting. – Peter Taylor – 2013-08-28T08:12:46.167

@Howard: Shoot, it was adapted from PHP 5.4 (I had too much difficulty installing the real PHP 5.2 [so I took : out of the set {because PHP 5.4 shows “unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM)”}]). Fixing that. – Ry- – 2013-08-28T14:41:58.397

This made me laugh. Very creative out-of-the-box thinking! – Qqwy – 2013-10-03T19:41:04.563

1I believe output is assumed to be stdout. This does not print to stdout. – Cruncher – 2013-11-28T14:46:56.117

Not all filesystems support naming files things like that. – AJMansfield – 2013-11-28T22:26:28.787

2@AJMansfield: I know… same to Cruncher. Don’t think it matters. – Ry- – 2013-11-28T22:27:49.823

@TheGuywithTheHat I agree with you, but this post predates that restriction. – Titus – 2018-05-17T16:04:50.290

Doesn't work in newer PHP versions since they fixed the confusing error message (now it includes the "<" in the error). It's still a cool solution though! – FIQ – 2014-02-04T11:50:41.700

I think the filename should count as part of the program if it is used. – MilkyWay90 – 2019-02-20T16:29:37.700

12

-1; http://meta.codegolf.stackexchange.com/a/1072/11066

– The Guy with The Hat – 2014-02-27T17:47:51.597

78I appreciate it, @TheGuywithTheHat, but I answered this about a year ago, as opposed to yesterday. – Ry- – 2014-02-27T18:07:14.730

9@TheGuywithTheHat This was one of the answers when the loophole was funny, new and lead to your linked meta post. Now it isn't anymore. – Johannes Kuhn – 2014-10-17T14:27:10.173

48

JavaScript - 88

alert("BCDFGHIJKMNPQUVXYZ".toLowerCase())// !#$%&'*+,-0123456789:;<=>?@[\]^_`{|}~AERTOWS

prints "bcdfghijkmnpquvxyz"

xem

Posted 2013-08-23T16:04:35.923

Reputation: 5 523

13Wow I like the toLowerCase idea, it's brilliant! – Pierre Arlaud – 2013-11-29T15:20:21.147

2You can save three characters with a bit of math: "!#$%&*+,-13:<=>?@[\]^_\{|}~AERTOWS";alert('BCDFGHIJKMNPQUVXYZ'.toLowerCase()+9572)because9572=6840` and moving the wasted characters to a string allows you to use the quotes instead of wasting them. Besides that, hiding characters in a comment feels cheesy. – Umbrella – 2018-03-12T12:40:31.993

28

Whitespace, 61 57 characters

It's not the shortest but it probably has the simplest logic (it's just a loop really).

Here it is completely commented, where S is space, T is tab, L is line feed:

SSSTSSSSSL     # push 0x20
LSSSL          # label S
SSSTL          # push 1
TSSS           # add
SLS            # duplicate top of stack
SLS            # duplicate again
TLSS           # output ASCII character
SSSTTTTTTSL    # push 0x7E
TSST           # subtract (result - 0x7E)
LTTSL          # branch to label S if top of stack is negative
LLL            # end

Thanks to @r.e.s. for correction to the above (required extra duplicate for the branch instruction) and for smaller numbers to push on the stack.

DPenner1

Posted 2013-08-23T16:04:35.923

Reputation: 971

1

This doesn't work as-is, but can be fixed by inserting a duplicate-top-of-stack (SLS) immediately before the conditional branch (LTTSL) -- it's needed because the conditional branch command removes the top-of-stack. The resulting 64-character program works as advertised. (If the program is stored in a file with .ws extension, it can be tested online at http://golf.shinh.org/checker.html)

– r.e.s. – 2013-08-25T16:24:35.143

1Also, the program length can be reduced to 57 using nearly the same program but with the three pushed numbers -94, 127, 126 changed to 32, 1, 126, respectively: SSSTSSSSSL LSSSL SSSTL TSSS SLS SLS TLSS SSSTTTTTTSL TSST LTTSL LLL. – r.e.s. – 2013-08-25T19:39:23.880

I know it's been over 5 years, but you can golf 5 bytes by changing the label S to label (empty) (LSSSL becomes LSSL and LTTSL becomes LTTL) and remove the exit at the end (the three LLL). Try it online raw 52 bytes or here with highlighting and explanation.

– Kevin Cruijssen – 2018-12-10T15:18:01.453

22

C, 83 74 69 characters

main(z) {for(;++z<96;"\33iE!vk?}GkRP8z"[z/7]&1<<z%7&&putchar(z+32));}

I really tried to get it down below 80 characters, but I just haven't been able to pull it off. I finally decided to post what I have, on the assumption that I (or someone else) will figure out 79-character solution ten minutes after posting this. Okay, it wasn't quite ten minutes, but it worked in principle.

I really wanted to post a version that didn't have to have a gratuitous space in the source code, but that one landed in a strange-attractor orbit, bouncing between a handful of solutions. After many minutes of trying to nudge one of them into a stable solution, I gave up and added the space.

breadbox

Posted 2013-08-23T16:04:35.923

Reputation: 6 893

69 characters, nice – galois – 2019-10-16T16:00:33.620

21

Golfscript, 26 24 characters

"126,32>''+".~\-'.~\-"'-

Takes a range generation script, duplicates it, executes it, substracts it from its result, then substracts the result subtraction code and the other quote character.

John Dvorak

Posted 2013-08-23T16:04:35.923

Reputation: 9 048

2Damn, that's clever. – marinus – 2013-08-23T17:28:19.900

1Remove ''+, escape program before subtraction, put in a noop .; (didn't find a better way to cover the dot), use code block instead of string -> {126,33>\-.;}.~` which is 16 chars – Howard – 2013-08-23T18:17:27.743

And utilising in any order, however many times you want you can also remove the semicolon. – Howard – 2013-08-23T18:52:15.043

@Howard I'm afraid I don't understand your idea. You can post it as a separate answer. – John Dvorak – 2013-08-23T18:53:46.623

@PeterTaylor I thought I printed a space? – John Dvorak – 2013-08-23T19:05:42.627

21

Fish - 80

zbcdjkpqruvwxaABCDEFGHIJKLMNOPQRSTUVWXYZ#!"'$%^&*()@!+-[]{},;:/\<>=?|~0123456789

When fish errors it prints out "something smells fishy...". Since z is a bad instruction it errors right away

Cruncher

Posted 2013-08-23T16:04:35.923

Reputation: 2 135

17

I know it's not winning any contests. I just wanted to try it in a language not normally used, just for kicks.

Java - 209 195 152 140 characters

class a{public static void main(String[]a){for(char c=0;;c++)System.out.print("publicas{tvodmn(Srg[])h=0;w+ye.\"\\xO<?:}".indexOf(c)<0?c:"");}}

With line breaks and tabs

class a{
    public static void main(String[]a) {
        for(char c=0;;c++)
            System.out.print("publicas{tvodmn(Srg[])h=0;w+ye.\"\\xO<?:} ".indexOf(c)<0?c:"");
    }
}

Beware if you execute: program does not terminate. Haha

Explanation

  1. for(char c=0;;c++): Since a char can be treated as an int, I use that to my advantage here to increment through all possible values of c. I omit the terminating condition in the loop (the one that would go between the two semicolons) in order to save on characters, since it wasn't specified that the program had to terminate. :)
  2. "publicas{tvodmn(Srg[])h=0;w+ye.\"\\xO<?:} ".indexOf(c)<0?c:"": Sadly, not a very elegant approach, but it gets the job done. Manually list every character present in the source code as a String literal, then check whether the current char c occurs within it with indexOf(). If the indexOf() call returns -1, it doesn't exist, and therefore we should print it. The rest of it just uses the ternary operator to save on characters and space.

asteri

Posted 2013-08-23T16:04:35.923

Reputation: 824

You can save a character by changing it to indexOf(++c) and removing the c++ inside the for loop – Daniel M. – 2016-05-09T14:54:54.627

can you explain a bit? – joey rohan – 2013-10-01T18:01:26.643

1@joeyrohan Sure, just added an explanation below it. :) – asteri – 2013-10-01T18:10:01.283

cool ;) nice stuff :) – joey rohan – 2013-10-01T18:12:21.747

2You could put the ENTIRE ascii printable table in a comment and make a java programm that returns nothing. It'd beat yours :-) – Pierre Arlaud – 2013-11-28T13:29:54.410

I gave an answer with 124 characters ;p – Pierre Arlaud – 2013-11-28T13:45:38.760

You can do indexOf(++c) to remove the increment part of the loop entirely, shaving off a character. – ICR – 2014-01-30T17:01:24.607

@ICR True. Nice catch. – asteri – 2014-01-30T17:05:57.237

>

  • You seem to be missing space (0x20) from your list of exclusions.
  • < – ICR – 2014-01-30T17:32:49.527

    start="2">

  • You can be slightly shorter by using if instead of the ternary because in this instance they're the same length, but you can remove ? and : from the string.
  • < – ICR – 2014-01-30T17:38:13.133

    9You could have told me that this is going to print every single Unicode character before I executed it in my terminal. – nyuszika7h – 2014-06-14T20:55:16.847

    14

    Ruby, 81 78 68 66 62 57

    (?!..?~).map{|a|$><<a if/[()ifmap{}|?!.~\/\\\[\]$><]/!~a}
    

    Simply checks itself. Duplicate characters manually removed.

    Thanks to Josh for saving 4 characters, and minitech for saving 5 characters!

    Doorknob

    Posted 2013-08-23T16:04:35.923

    Reputation: 68 138

    Can't you put the if after the $><<x to save one of the end lines? – Josh – 2013-08-23T23:10:54.200

    @Josh Yes. I will do that now. – Doorknob – 2013-08-23T23:26:22.720

    You can take it to 58: (?!..?~).map{|x|$><<x if/[()ifmap{}|x?!.~\/\\\[\]$><]/!~x} – Ry- – 2013-08-25T15:15:41.830

    1Ah, and with a better choice of variable name, 57: (?!..?~).map{|a|$><<a if/[()ifmap{}|?!.~\/\\\[\]$><]/!~a} – Ry- – 2013-08-25T15:18:04.687

    $><<((32..126).map(&:chr)-IO.read(__FILE__).chars).join 55 bytes using a different approach. – twe4ked – 2017-03-12T22:36:48.003

    47 bytes using grep instead of map – Value Ink – 2019-10-16T00:17:08.720

    14

    Perl, 49 characters

    say grep/[^+-246\[-^aceghmprsy]/,map chr,041..126
    

    This is an interesting challenge -- it's sort of the anti-quine, and I've managed to shorten the program a couple of times by increasing the range of characters that appear in it.

    breadbox

    Posted 2013-08-23T16:04:35.923

    Reputation: 6 893

    14

    Befunge (48)

    <|::-1,+*88:<+3*87
    6<@.**85
    9>"()~&"/%$ |!#';=?}
    

    Outputs: {zyxwvutsrqponmlkjihgfedcba`_^][ZYXWVUTSRQPONMLKJIHGFEDCBA240

    FireFly

    Posted 2013-08-23T16:04:35.923

    Reputation: 7 107

    Holy cow! Nice work! – Cruncher – 2013-11-28T18:21:10.843

    12

    Not very serious, but I had to give it a go:

    JSFuck (138152)

    (compiled source here)

    Original source:

    for(x=0x7e;x>0x19;x--){
        console.log(String.fromCharCode(x).replace(/[\[\]!\+\(\)]/ig, ''))
    }
    

    Prints all characters except ()+[]!

    Qqwy

    Posted 2013-08-23T16:04:35.923

    Reputation: 523

    2(x) <=> [x][+[]], increases code size but makes the alphabet needed smaller. – FireFly – 2013-10-03T21:18:04.463

    12

    Your task is to build a program (using only printable ASCII characters and/or tabs and newlines)

    Gosh, you made it hard for APL (Is that delibarate?)
    So I decide to Ignore All Rules!!!

    APL(Dyalog), 3 10

    ⎕AV
    

    Prints the atomic vector (which includes all prinable ASCII characters)


    Turns out I completely forgot about the "without" part...
    But that's an easy fix

    ⎕AV~'AV'''
    

    ~'AV''' means exclude (~) the characters A, V and single quote (escaped as doubled single quotes)

    Regarding printing non-ASCII, well, I am Ignoring All Rules.

    TwiNight

    Posted 2013-08-23T16:04:35.923

    Reputation: 4 187

    "print[s] out exactly the characters in the printable ASCII space (0x20 to 0x7e) that don't appear in your program's source code" I believe the output may not contain characters outside of the printable ASCII space ("exactly" being the keyword), and your program contains 'A' and 'V' so they should not be printed. – FireFly – 2013-10-04T18:11:10.337

    1You'll at least want to add ~ to the set of excluded characters. ;-) Btw, a similar J solution would be a.-.'a.-''' – FireFly – 2013-10-04T19:14:42.937

    2You can Ignore All Rules, but that does disqualify you from being the accepted answer. – Joe Z. – 2013-10-12T02:35:32.670

    11

    GolfScript (18 16 chars)

    "),@`^^32>#.~".~
    

    Online demo with an extra line which does a correctness check and outputs the number of characters in error.

    (I have various equivalent alternatives. @`^ can be replaced with \\`; # can be replaced with ` or ]. The right combination can be used with Howard's trick to equal his score of 15 because backslashes don't need escaping in blocks the way they do in string literals: {),\`^32>].~}.~. But Howard deserves the credit for that trick).

    Peter Taylor

    Posted 2013-08-23T16:04:35.923

    Reputation: 41 901

    1

    nice rule abuse :-) http://golfscript.apphb.com/?c=ImAnficoLCszMj5cXC0uIi5%2B

    – John Dvorak – 2013-08-23T19:09:01.470

    2Fortunately ascii ends in }~ - even better for code blocks, see my new answer ;-) – Howard – 2013-08-23T20:22:56.937

    11

    Brainfuck, 173

    +++++[->++++++<]>>>++[------<+>]<++++>>----[----<+>]>-[-------<+>]>-[---<+>]<------->>-[---<+>]<+++++++++>>--[-----<+>]<+++++>>+[---------<++>]+++++++++++++[<[.+<]>[>]<-]\=,
    

    Pretty long, I might try again later.

    copy

    Posted 2013-08-23T16:04:35.923

    Reputation: 6 466

    6write a program that does nothing and add the rest od ascii to the source, worst case feels like 96 characters. – Jasen – 2014-12-27T02:13:46.347

    10

    J (52 40)

    Edit: Duh, forgot about e.

    '''(-@.e#[)~95{32}a'(-.@e.#[)~95{.32}.a.
    

    Old version:

    (>@(*/@('(>@*/''&~:).#]32{95}a'&~:)&.>)#])95{.32}.a.
    

    Other variant (same length but less output):

    ([#~*/"1@('([#~*/"1@''&:0)95{.32}a'&~:"0))95{.32}.a.
    

    marinus

    Posted 2013-08-23T16:04:35.923

    Reputation: 30 224

    @marinus I have one in J that's 24 characters. – FUZxxl – 2015-01-26T22:06:21.677

    @JanDvorak: whoops typo – marinus – 2013-08-23T16:34:38.647

    Darn it! I was hoping I could get low enough in Ruby to beat you and then you drop it all the way to 40. :P – Doorknob – 2013-08-23T17:08:24.653

    The new one looks much more quiney. – John Dvorak – 2013-08-23T17:10:39.007

    1@Doorknob: I have one in APL that's only 24 characters but it has non-ASCII characters in it. – marinus – 2013-08-23T17:11:53.397

    Yeah, I did the ASCII thing to avoid languages like APL. – Joe Z. – 2013-08-23T19:38:35.727

    7

    Python 3 - 68 61

    x=r"print(*set(map(chr,range(32,127)))-set(x+'=\"'))"
    exec(x)
    

    ... thanks to @WolframH for the improvements.

    user8943

    Posted 2013-08-23T16:04:35.923

    Reputation:

    1I think you can put exec(x) in a new line and save the ; in x. Also, in Python 3, you can use x=r"print(*set(map(chr,range(32,127)))-set(x+'=\"'))"\nexec(x) for 61 chars (prints multiple spaces, which is allowed). – Reinstate Monica – 2013-08-24T22:46:35.360

    @WolframH ingenious, thanks! – None – 2013-08-24T23:13:44.463

    Massively late, I know, but with some new Python 3 tricks you can take it down to 55 chars: x=r"print(*{*map(chr,range(32,127))}-{*x})#=\""\nexec(x). – sagiksp – 2019-10-21T12:52:15.037

    7

    PowerShell: 96

    Must be saved and run as a script.

    diff([char[]](gc $MyInvocation.InvocationName))([char[]](32..126))-Pa|?{$_.SideIndicator-eq'=>'}
    

    diff is a built-in alias for Compare-Object.

    gc is a built-in alias for Get-Content.

    $MyInvocation.InvocationName gets the full path to the script being executed.

    32..126 is the decimal equivalent for 0x20..0x7e, and so creates an array of the decimal ASCII codes we're looking for.

    [char[]] takes the contents of the next object and puts them into an array, breaking them up and converting them into ASCII characters. So, we now have two arrays of ASCII characters - one pulled from this script, the other defined by the challenge criteria.

    -Pa sets Compare-Object to "Passthru" format, so only the items which are found different between the inputs are output at the console - indicators of which items were in which input are still stored in the object's data, but are not displayed.

    |?{$_.SideIndicator-eq'=>'} pipes Compare-Object's output to Where-Object, which filters it down to only the items which are exclusive to the second input.

    Iszi

    Posted 2013-08-23T16:04:35.923

    Reputation: 2 369

    Sane and instructive. – Stéphane Gourichon – 2015-03-19T19:35:52.507

    7

    PHP - 92

    <? //A"$%&'()*+[,.]0123456789:=-@ABCDEFGHIJKLMNOPQRSTUVWYZ\^_`abcdefghijklmopqrstuvwxyz{|}~#
    

    Output:

    nothing

    The OP asks to print all the unused characters, well, I just use them all

    Fez Vrasta

    Posted 2013-08-23T16:04:35.923

    Reputation: 1 078

    I knew that there would be a submission that just uses all the characters. – MilkyWay90 – 2019-02-20T16:34:22.950

    1This doesn't use the characters !;>Xn – Jo King – 2019-04-12T03:42:51.150

    What about <?='A"$%&\'()*+[,.]/0123456789:=-@ABCDEFGHIJKLMNOPQRSTUVWYZ\^_\abcdefghijklmopqrstuvwxyz{|}~#'`? – jocap – 2014-09-01T14:24:24.497

    6

    Javascript, 92

    (function f(){for(i=32;126>i++;)!~(""+f).indexOf(c=String.fromCharCode(i))&&console.log(c)})()
    

    C5H8NNaO4

    Posted 2013-08-23T16:04:35.923

    Reputation: 1 340

    Is this a fair solution?

    alert(' !"#$%^*+/-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`bcdfghijkmnopqsuvwxyz{|}~')
    
    

    Comes in at 95 chars and is dumb as hell. :p – tristin – 2013-10-02T18:59:15.853

    2@tristin :P yeah javascript is a bit verbose when it comes to charcode to string. And isn't it output every character your program dosn't have. The text your alerting is in your program as well :) – C5H8NNaO4 – 2013-10-03T09:09:09.470

    1Haha, oops. Oh well. – tristin – 2013-10-03T19:09:50.440

    6

    Java - 126 characters

    minimized:

    class hjq{public static void main(String...w){for(char z='"'|0;++z!='a';)if("'()+.0;=OS".indexOf(z)==~0)System.out.print(z);}}
    

    unminimized:

    class hjq {
        public static void main(String... w) { 
            for (char z = '"'|0; ++z != 'a';) {
                if ("'()+.0;=OS".indexOf(z) == ~0) {
                    System.out.print(z);
                }
            }
        }
    }
    

    This is an interesting problem, because individual tokens might benefit from their longer form because it re-uses characters. For example, normally String[] would be shorter, but String... removes the need for the square brackets in the conditional string.

    I found the trick was to try and use characters at the beginning and end of the range so you can exclude them from the output simply by altering your loop start and end.

    For Java, a key character to exclude is ", because having that in the string requires escaping it, which adds \ to your program, which needs to go in the string, which adds \\. By removing " from your conditional string you remove 4 characters. This can be achieved by making sure you use and ! and starting your loop from #.

    All the lowercase letters appear near the end of the range, with only {, |, } and ~ coming after them. Because of Java's verbosity, most of the lowercase letters are used just for the boilerplate. Likewise, { and } are trivial for a Java program, because the boilerplate requires them.

    | can be used if you have an or condition, but I couldn't find a way to take advantage of one that leads to a shorter program than just using | as a bitwise operator. The |0 makes me feel a little dirty, because it's the only part that's a nop just to get the character in there.

    ~0 yields -1, which is handy because that's what we need to check for with indexOf. Combining this with using != for the loop conditional eliminates the < character altogether, which means it doesn't need to go inside the conditional string.

    ICR

    Posted 2013-08-23T16:04:35.923

    Reputation: 211

    5

    sh (47)

    tr</dev/urandom -cd \[:print:]|tr -d "`cat $0`"
    

    Uses the self-referential approach. Assumes /dev/urandom will eventually output every octet at least once. Doesn't terminate.

    If we assume that man is installed, we could instead make use of the ascii(7) manpage (and thus have a terminating program) (44 chars, thanks @fennec).

    man ascii|tr -cd \[:print:]|tr -d "`cat $0`"
    

    FireFly

    Posted 2013-08-23T16:04:35.923

    Reputation: 7 107

    Could you use another file, possibly with a shorter name, that's essentially guaranteed to have all possible octets? and might even terminate? I'm thinking like /dev/memory or something. – None – 2014-01-30T14:20:51.123

    @fennec if we assume that man and zsh are installed, man zshall seems to fit the criteria. I could add that as a variation. – FireFly – 2014-01-30T18:20:06.380

    man ascii could save you another letter, I think. – None – 2014-01-31T02:51:37.583

    Which tr are you using? GNU tr treats the - in "cat $0" as a range operator, which breaks the output. – Toby Speight – 2018-05-21T10:15:22.603

    BTW, if the ascii program is installed, you could use that in place of man ascii. – Toby Speight – 2018-05-21T10:16:24.477

    5

    BitShift, 1038 bytes

    BitShift is a language which only supports 0 and 1 as syntax. I figured it would be easy to print all other characters, but since it doesn't really support looping it still ended up a massive 1038 bytes.
    However, I believe it's not really possible to go any smaller than this..

    101001100101011011010100110111010100100101011001101111010100100101011001000101011011010100101100110110101001001010110010001010110110101000001101010010010101100100010101101101010000010000011001010110110101000010000101011011010100110111010100100101011111100101011011010100110111010100100101011001101111010100100101011001000101011011010100000000011010100100101011001000101011011010100110010000101011011010100110111010100100101011001101001101010010010101100100010101101101010011001000010101101101010011011101010010010101111011111110010101101101010011011101010010010101100101100101011011010100010001010110110101001000010101101101010011011101010010010101110111110010101101101010011011101010010010101111111100101011011010100110111010100100101011111011110101001001010110010001010110110101001000100000101011011010100110111010100100101011111010011010100100101011001000101011011010100100000101011011010100110111010100100101011001101111010100100101011001000101011011010100010000010101101101010011011101010010010101101001101101010010010101101001101010
    

    Prints

     !"#$%&'()*+,-./23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
    

    Try it here

    Bassdrop Cumberwubwubwub

    Posted 2013-08-23T16:04:35.923

    Reputation: 5 707

    4

    Definitely the longest solution here, but coding in Lino is always fun:

    L.in.oleum - 655 523 characters

    "libraries"/arch/cpu/base;/hmi/conout;/data/bytes;/data/string/t2s;/data/heap;/data/heap/connect/mgrab;"stockfile"a;"directors"displaystatus=engage;"injection"c=524;b<-bytes.bytesizeconvert:c;b<-heap.alloc:b;a<-heap.alloc:c;[filecommand]=readfile;[filename]=stockfile;[fileposition]=0;[fileblocksize]=c;[fileblockpointer]=b;arch.fileread;[string.psource]=b;[string.ptarget]=a;string.t2s;b<-heap.alloc:7fh;c=32;d=b;"f"[d_32]=c;+c;+d;?c<7fh>f;"w"d=[a];+a;?d=0>y;?d<32>w;?d>7eh>w;e=b;e+d;[e]=33;^w;"y"b+32;"v"conout.say:b;bye;
    

    No comments, just reads the source compiled into binary. Save as a.txt or it won't compile!

    gronostaj

    Posted 2013-08-23T16:04:35.923

    Reputation: 141

    4Nope, the JSFuck one is longer. – Joe Z. – 2014-12-31T20:38:59.053

    4

    Haskell (70)

    import Data.List
    main=putStrLn$[' '..'~']\\" \\\"$'.=DLS[]aimnoprstu~"
    

    The boring duplicate-characters-in-program-in-a-string, subtract-from-universal-set solution. Far from a codegolf winner, though it's surprisingly legible for its length.

    (Now with list subtraction instead of filter/notWith.)

    FireFly

    Posted 2013-08-23T16:04:35.923

    Reputation: 7 107

    you can change import Data.List to import List – proud haskeller – 2014-08-28T15:06:13.460

    .@proudhaskeller huh, really? It doesn't seem to work when I try it with runhaskell: "Could not find module ‘List’". I noticed I'd miscount the number of characters though, so I corrected it. – FireFly – 2014-08-28T16:59:43.007

    1well, that's weird, try it with ghc or ghci? It works for me – proud haskeller – 2014-08-28T17:01:00.023

    @proudhaskeller nope, can't get it to work. This is with GHC 7.8.3. – FireFly – 2014-08-28T17:19:09.587

    4

    Brainfuck, 133 123 114 110 bytes

    ++++++++++++++++[->++++++>++>+++>++++>++<<<<<]>-->>->->+[---<.+.+<.+<.+<.+.+.+>>>>]++[-<.+.+.+<.+>>]<+.<+.<++.
    

    A bit of more tinkering with a former solution (before I realized the below was smaller - allthough this was before I did some heavy optimization). This works by storing 4 sets of ascii numbers and print them with some tricky looping, and then give the missing characters afterwards (i.e. ones that are between invalid ascii numbers).

    Original submission

    >>+++++++++++[<+<+>>->++>+++<<]<++>>++++++>>+++++[-<<<++++++>>>]<<<+<<[->>+.<<]>>++.++<[->+.<]>++.+>[-<+.>]<++.+>>[-<<+.>>]
    

    It does the following:

    • Create 4 registers containing 11. 13, 28, 33
    • Create a 5th with the value 31 to start the printing
    • Print ascii 32-42 (11)
    • Print ascii 44
    • Print ascii 47-59 (13)
    • Print ascii 61
    • Print ascii 63-90 (28)
    • Print ascii 92
    • Print ascii 94-126 (33)

    FIQ

    Posted 2013-08-23T16:04:35.923

    Reputation: 519

    3

    Python 2, 69

    for x in range(38):print chr(x+59)#!"$%&'*,-./012467bdjklmqsuvwyz{|}~
    

    I use the longest (that I'm able to find) sequence of continuous chars I can print out and add the others as a comment after the code.

    miles

    Posted 2013-08-23T16:04:35.923

    Reputation: 15 654

    8I'm not going to upvote anything that has a comment – John Dvorak – 2013-08-23T16:46:49.763

    My answer should show the worst possible way to solve this task. (Use the comment loophole). – Johannes Kuhn – 2013-08-23T16:52:59.520

    9ok... except for that polyglot that is nothing but a comment. – John Dvorak – 2013-08-23T17:04:27.933

    @JohannesKuhn However, as it's the longest code that works, it won't win the contest. :P – Joe Z. – 2013-08-23T17:11:29.930

    5@JoeZ. it wins by a wide margin if you divide by the number of languages it works in – John Dvorak – 2013-08-23T19:09:48.487

    It's no longer even the longest code, so my comment no longer applies. – Joe Z. – 2013-08-25T20:30:55.827

    3

    Python 2, 68 83 88 (but it actually reads the file)

    No comments, no hacks, it just opens itself, and checks the contents. Includes the set logic from this answer.

    print"".join(set(map(chr,range(32,127)))-set(open(__file__).read()))
    

    Changed to print the output and not an array.

    user8777

    Posted 2013-08-23T16:04:35.923

    Reputation:

    1Outputs the following characters which are in the program: 127[]acdefrtx – None – 2013-08-24T02:24:30.983

    @ZeroPiraeus I've corrected that, and have met your score! – None – 2013-08-24T05:47:00.180

    3These are definitely not ASCII characters. ASCII below 32 only contains control codes (Backspace, Bell, etc.), whitespace (CR, LF, tab), and the null char. – Felix Dombek – 2013-08-24T13:25:55.490

    1

    @Felix These are from Code page 437 (which starts at U+2639, I believe)

    – Doorknob – 2013-08-24T15:02:10.630

    @FelixDombek Windows has lied to me again, removed the last bit. – None – 2013-08-24T22:45:01.533

    1You can get this down to 62 chars in python3 using @WolframH 's idea: print(*set(map(chr,range(32,127)))-set(open(__file__).read())). Longer by 1 character than the other answer, but more pythonic in my opinion – Peter Gibson – 2013-08-29T01:47:15.717

    Python 3 can actually get down to 58 bytes

    – Jo King – 2018-06-19T01:42:57.923

    3

    J - 21

    (u:32+i.97)-.1!:1<":5
    

    write this to a file called 5 in the current directory. Then load execute the script with 0!:1<'5'

    Or 25 without the file trick:

    (-.~".)'(":u:32+i.0-~95)'
    

    jpjacobs

    Posted 2013-08-23T16:04:35.923

    Reputation: 3 440

    Source code contains ', which isn't removed from the output. – FireFly – 2014-07-13T02:52:39.873

    3

    Cubically, 61 bytes

    Code:

    ~:5+1-777(B1D1+7)6+33077777(D3B3@6-7)0&2 !"#$%'*,./489;<=>?AC
    

    Unique characters in program:

     !"#$%&'()*+,-./0123456789:;<=>?@ABCD~
    

    Output:

    EFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}
    

    TehPers

    Posted 2013-08-23T16:04:35.923

    Reputation: 899

    3

    brainfuck, 90 bytes

    ++++[->+++>++++++++<<]>-[->.>+<+<]>+.+++>++[-<.<++>+>]<+.++<++[->.>+<+<]>+.++>+++++[-<.+>]
    

    Try it online!

    Tape Layout:

    [Initial Count Cell] , [Counter Cell One] , [Ascii Cell] , [Counter Cell Two]

    Explanation:

    ++++[->+++>++++++++<<]>-      # sets counter cell one to 11 and ascii cell to 32
    [->.>+<+<]                    # prints ascii 32-42 and creates counter cell two
    >+.+++>++                     # prints ascii 44 and sets counter cell two to 13
    [-<.<++>+>]                   # prints ascii 47-59 and resets counter cell one
    <+.++<++                      # prints ascii 61 and sets counter cell one to 28
    [->.>+<+<]                    # prints ascii 63-90 and resets counter cell two
    >+.++>+++++                   # prints ascii 92 and sets counter cell two to 33
    [-<.+>]                       # prints remaining ascii characters
    

    Output:

     !"#$%&'()*,/0123456789:;=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\^_`abcdefghijklmnopqrstuvwxyz{|}~
    

    X1M4L

    Posted 2013-08-23T16:04:35.923

    Reputation: 1 586

    3

    R, 72 bytes

    cat(intToUtf8(setdiff(32:126,utf8ToInt("\\\"(),12368:ITUacdefinostu"))))
    

    Try it online!

    With correction from @JayCe

    ngm

    Posted 2013-08-23T16:04:35.923

    Reputation: 3 974

    nicely done! Beats out the default polyglot by a fair margin! – Giuseppe – 2018-05-15T18:49:20.320

    1I think you're missing \\ in the string which costs 2 bytes :( Otherwise I tried to golf it further but couldn't - clever use of setdiff ! – JayCe – 2018-05-16T20:21:19.387

    3

    Deadfish~, 70 55 51 bytes

    {iii}i{icicicicicic}dd{ci}iicicicici{ic}dd{ci}iciic
    

    Because, y'know, I'm hilarious and original.

    Saved 15 bytes by repeating a few characters
    Saved 4 more by simplifying both instances of d{ic}i to {ci}

    Try it online!

    Previous Version (55 bytes):

    {iii}i{icicicicicic}ddd{ic}iiicicicici{ic}ddd{ic}iiciic
    

    Reinstate Monica

    Posted 2013-08-23T16:04:35.923

    Reputation: 1 382

    3

    Ink, 91 86 bytes

    {POW(77,7)} /*-#!"$%&'9:;<=>?@ABCDFGHIJKLMNQRSTUVXYZ[\]^_`abcdefghijklmnopqrstuvwxyz|~
    

    Try it online!

    Prints 1.604852E+13

    The only thing Ink can really do to a string is print it - if you want to do actual string processing, you're meant to hook into external code. This means almost all characters will have to occur in our code, since we generally have no way to print the ones that don't. That means we can basically treat the first occurrence of each character as being free, and see how much stuff we can generate with as few repeated characters as possible.

    One thing Ink can do is math. We can generate and print a number. With only two repeated characters, the expression {POW(77,7)} becomes 1.604852E+13, which has eleven distinct characters, none of which are used in the expression.

    At this point, there isn't much more we could generate. We need 7 in our code, and while we might be able to generate a -, we'd need another set of {} to do more math, so that would really be a net negative. So we begin a multi-line comment using /* (because Ink doesn't care if we ever close those) and shove all the rest of the characters we aren't using in there.

    • -5 bytes by creating a larger floating-point number using POW instead of FLOAT, which then also includes E and + and has fewer repeated characters

    Sara J

    Posted 2013-08-23T16:04:35.923

    Reputation: 2 576

    3

    Clojure (142, 106, 103)

    (defn -main[](let[c"(fn[l](pr(reduce disj(set(map char(range 32 126)))l)));-\\\"o"]((load-string c)c)))
    

    formatted:

    (defn -main []
      (let [c "(fn[l](pr(reduce disj(set(map char(range 32 126)))l)));-\\\"o"]
        ((load-string c) c)))
    

    Think this does it, may need some tweaks. output:

    #{@ ` ! A B b # C $ D % E & F ' G H I * J + K k , L M . N / O 0 P Q q R S 4 T 5 U V v 7 W w 8 X x 9 Y y : Z z { < | = } > ^ ? _}
    

    runs the string, which is evaluateable clojure code, on itself. String has some comments at the end to get the characters used outside of the string (main method, etc)

    RedDeckWins

    Posted 2013-08-23T16:04:35.923

    Reputation: 151

    3

    Bash (pure), 93 92 88 bytes

    eval "a=$'$(printf '\\x%x' {32..127})'"
    while read -rn1 c;do a=${a/"$c"};done<$0
    echo $a
    

    Example

    cat > foo.sh # now paste and C-d
    bash foo.sh  # !#&*+,45689:>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`bgjkmqsuyz|~
    wc -c foo.sh # 93 (including end-of-line \n)
    

    Explanation

    • The eval thing: construct a string that looks like \x20\x21...\x7f, and use bash&ksh's c-style-quote $'c-escape-str' to wrap it, in order to escape it into some real list-of-chars.
    • Then we use a while loop to read chars one-by-one, and use the 'replace first occurance' ${var/pat} to kill corresponding chars in $a. Note that we didn't set IFS properly, and read by default will consume \x20, \n and \t. The \x20 part will be handled later.
    • Finally we abuse IFS again so it can eat the space.

    The output is in ASCII char order.

    This very literal (for code golfs at least) one actually ended up smaller than what I expected it to be. Otherwise I will be thinking about # !&*+abc....

    Arthur2e5

    Posted 2013-08-23T16:04:35.923

    Reputation: 143

    2

    Q, 44

    -1"c"$til[128]except"i"$"-1\"c$til[28]exp;";
    

    .

    q)-1"c"$til[128]except"i"$"-1\"c$til[28]exp;";
    345679:<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\^_`abdfghjkmnoqrsuvwyz{|}
    

    tmartin

    Posted 2013-08-23T16:04:35.923

    Reputation: 3 917

    2

    Java - 111 Bytes

    I know I'm 4 years too late, but I just found this question.

    void SPARE_VOMIT(){System.out.print(0!=('^'>>8|3&6%2<<~7*4)?"$#/^@\bc[]":'`'-5+"lnbfghjkqwxyz".toUpperCase());}
    

    I tried to put as few characters in the ignored String as possible.

    Ungolfed:

    void SPARE_VOMIT(){                                   // vomit out all the spare characters
        System.out.print(0 != ('^'>>8|3&6%2<<~7*4) ?             // Both sides here = 0
                         "$#/^@\bc[]"              :             // The shame string...
                         '`'-5 + "lnbfghjkqwxyz".toUpperCase()); // Print 91 and caps.
    }
    

    Lord Farquaad

    Posted 2013-08-23T16:04:35.923

    Reputation: 1 513

    2SPARE_VOMIT... heh... +1 – Magic Octopus Urn – 2017-08-03T14:51:37.143

    2

    dc, 83 79 bytes

    120d115 108 100 93 91 80 62[d1-d43<:]ds:x[l.dP]s;34s.[dl.!=;s,l.1+ds.127>/]ds/x
    

    Try it online!

    Prints "#$%&'()*?@ABCDEFGHIJKLMNOQRSTUVWXYZ\^_`abcefghijkmnopqrtuvwyz{|}~

    The lazy answer of commenting out the entire printable range (and printing nothing) would be 95 bytes, so while this may be suboptimal, I'm pretty pleased.

    120d115 108 100 93 91 80 62[d1-d43<:]ds:x puts all the values on the stack that we need to ignore. Decimal is seemingly the ideal base for this, particularly when I factor in the additional characters that would be needed to change the input base. The first few values I have to enter in manually, but I use all the characters from 43-62, so I can generate those in a loop. I don't need to use a few of these characters, but it saves bytes to run through the ones that I don't need, so I named my registers/macros :, ., ,, ;, and / for the sake of using those characters.

    [l.dP]s; is the macro that will print the character if it's not in the list. 34s. is the counter - since I use characters 32 and 33, I just start at 34. [dl.!=;s,l.1+ds.127>/]ds/x is a pretty straightforward macro, just load the counter, ., see if it's in the list, run ; if so, increment, and loop until we're out of printable range.

    Golfed off four bytes because I was accidentally omitting p (this also made my answer invalid!). I must have at one point used both P and p to print, or thought I would have to.

    brhfl

    Posted 2013-08-23T16:04:35.923

    Reputation: 1 291

    2

    ><>, 44 43 37 35 bytes

    crossed out 44 is still regular 44 ;(

    " 'r:{-}30{l4-*?.~~:9e*=?;:l2=?o1+}
    

    Try it online!

    Outputs !#$%&(),/5678<>@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdfghijkmnpqstuvwxyz|

    How It Works:

    "   Wrapping string literal, adding the source code to the stack.
        This adds a space at the start to initialise the counter
      '  Runs another string literal over the whole code
         This means both " and ' are added to the stack
       r:  Get the counter from the bottom of the stack and duplicate it
         {-}  Get the bottom of the stack and check if it is equal to the counter. Push the check to the bottom of the stack
            30  Add 3, 0 to the stack for later
              {l4-*  Get the equality check from the bottom of the stack and OR it with whether the stack is empty of values to check against
                   ?.  If the character is equal or the stack is empty, continue. 
                       Else set the instruction pointer to 3,0 to check against the next character
                     ~~  Pop the excess 3,0
                       :9e*=?;  Check if the counter is equal to the 126, the last character, and end if so.
                              :l2=?o  If the stack is empty of values to check (ie the character is not in the code), print it.
                                    1+}  Add one to the counter and, because ><> is toroidal, loop back to the beginning
    

    Jo King

    Posted 2013-08-23T16:04:35.923

    Reputation: 38 234

    Crossed out 4 is still 4 ;( – FantaC – 2018-01-12T01:47:26.690

    2

    05AB1E, 33 bytes

    157 255B'QJ.V"157 2B'QJ.VSK"SK'"K
    

    Try it online!


    Pushes žQ by converting 157 into base 255.

    Executes žQ with .V which pushes the printable ASCII character set (32-128).

    Then remove all characters in the source code using K.

    Magic Octopus Urn

    Posted 2013-08-23T16:04:35.923

    Reputation: 19 422

    I have the feeling the program string can somehow be combined with a D.VsSK but I'm unable to find a way to accomplish it..:( That J screws things up so much.. +1 though, nice answer. – Kevin Cruijssen – 2019-04-12T09:33:06.577

    1

    Ok, found something! :) "YSK157 255B'QJ.V"VY.VYSK'"K 28 bytes "YSK157 255B'QJ.V" is the string. This is popped and saved in variable Y, after which it's pushed again, and executed with .V (the YSK are no-ops; and the 157 255B'QJ.V is still the same as in your answer). Then the characters of this string Y are removed with YSK, and finally the double quote is removed (again, same as in your answer) with '"K.

    – Kevin Cruijssen – 2019-04-12T09:46:39.160

    1

    @KevinCruijssen your 28 can easily be 25 by merging the two YSK. Using modern 05AB1E, I can get 24 with "8!55+257B.V3.$YSK"VY.V.

    – Grimmy – 2020-01-16T22:50:53.357

    2

    Memory GAP, 3104 bytes

    74b87337454200d4d33f80c4663dc5e5f7bd60b75b29d79b660a2859395c1a240e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf47cef8a734855777c2a9d0caf42666e69b21afc54fb48d153c19101658f4a2a480e9f1e8e40bb79e800b0cc9433830cf40e9f1e8e40bb79e800b0cc9433830cf40e9f1e8e40bb79e800b0cc9433830cf4594f803b380a41396ed63dca39503542f7bd60b75b29d79b660a2859395c1a240e9f1e8e40bb79e800b0cc9433830cf40e9f1e8e40bb79e800b0cc9433830cf40e9f1e8e40bb79e800b0cc9433830cf40e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a092433234ec78fcc91ffb1e54cd85e4a092433234ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a092433247bce5c74f589f4867dbd57e9ca9f808f7bd60b75b29d79b660a2859395c1a2434ec78fcc91ffb1e54cd85e4a092433234ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf4594f803b380a41396ed63dca395035420e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a0924332f7bd60b75b29d79b660a2859395c1a2434ec78fcc91ffb1e54cd85e4a09243320cc175b9c0f1b6a831c399e269772661f7bd60b75b29d79b660a2859395c1a24f24c2c15b9d03797c6874986a8d1951634ec78fcc91ffb1e54cd85e4a0924332faf05c15dfad45dafd1fc23d51236853f0a1dfdc675b0a14a64099f7ac1cee8374b87337454200d4d33f80c4663dc5e5f7bd60b75b29d79b660a2859395c1a240e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf40e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a092433234ec78fcc91ffb1e54cd85e4a09243320cc175b9c0f1b6a831c399e269772661f7bd60b75b29d79b660a2859395c1a2434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf4594f803b380a41396ed63dca39503542f7bd60b75b29d79b660a2859395c1a2434ec78fcc91ffb1e54cd85e4a0924332faf05c15dfad45dafd1fc23d5123685334ec78fcc91ffb1e54cd85e4a09243320cc175b9c0f1b6a831c399e269772661f7bd60b75b29d79b660a2859395c1a24f0a1dfdc675b0a14a64099f7ac1cee83f24c2c15b9d03797c6874986a8d1951634ec78fcc91ffb1e54cd85e4a09243327cef8a734855777c2a9d0caf42666e69b21afc54fb48d153c19101658f4a2a48a87deb01c5f539e6bda34829c8ef2368c68271a63ddbc431c307beb7d2918275852438d026c018c4307b916406f98c6274985f5115ad149212a917dbef8ec801b21afc54fb48d153c19101658f4a2a480cc175b9c0f1b6a831c399e269772661f7bd60b75b29d79b660a2859395c1a2434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf474b87337454200d4d33f80c4663dc5e5f7bd60b75b29d79b660a2859395c1a240e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf40e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243324124bc0a9335c27f086f24ba207a4912f7bd60b75b29d79b660a2859395c1a24f24c2c15b9d03797c6874986a8d1951634ec78fcc91ffb1e54cd85e4a0924332faf05c15dfad45dafd1fc23d5123685374985f5115ad149212a917dbef8ec801
    

    Try it online!

    Expanded:

    74b87337454200d4d33f80c4663dc5e5f7bd60b75b29d79b660a2859395c1a240e9f1e8e40bb79e8
    00b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf4
    34ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e
    54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf47cef8a734855777c2a9d0caf42666e69
    b21afc54fb48d153c19101658f4a2a480e9f1e8e40bb79e800b0cc9433830cf40e9f1e8e40bb79e8
    00b0cc9433830cf40e9f1e8e40bb79e800b0cc9433830cf4594f803b380a41396ed63dca39503542
    f7bd60b75b29d79b660a2859395c1a240e9f1e8e40bb79e800b0cc9433830cf40e9f1e8e40bb79e8
    00b0cc9433830cf40e9f1e8e40bb79e800b0cc9433830cf40e9f1e8e40bb79e800b0cc9433830cf4
    34ec78fcc91ffb1e54cd85e4a092433234ec78fcc91ffb1e54cd85e4a092433234ec78fcc91ffb1e
    54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a0924332
    47bce5c74f589f4867dbd57e9ca9f808f7bd60b75b29d79b660a2859395c1a2434ec78fcc91ffb1e
    54cd85e4a092433234ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf4
    594f803b380a41396ed63dca395035420e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e
    54cd85e4a0924332f7bd60b75b29d79b660a2859395c1a2434ec78fcc91ffb1e54cd85e4a0924332
    0cc175b9c0f1b6a831c399e269772661f7bd60b75b29d79b660a2859395c1a24f24c2c15b9d03797
    c6874986a8d1951634ec78fcc91ffb1e54cd85e4a0924332faf05c15dfad45dafd1fc23d51236853
    f0a1dfdc675b0a14a64099f7ac1cee8374b87337454200d4d33f80c4663dc5e5f7bd60b75b29d79b
    660a2859395c1a240e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a0924332
    0e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e8
    00b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf4
    0e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a092433234ec78fcc91ffb1e
    54cd85e4a09243320cc175b9c0f1b6a831c399e269772661f7bd60b75b29d79b660a2859395c1a24
    34ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf4594f803b380a4139
    6ed63dca39503542f7bd60b75b29d79b660a2859395c1a2434ec78fcc91ffb1e54cd85e4a0924332
    faf05c15dfad45dafd1fc23d5123685334ec78fcc91ffb1e54cd85e4a09243320cc175b9c0f1b6a8
    31c399e269772661f7bd60b75b29d79b660a2859395c1a24f0a1dfdc675b0a14a64099f7ac1cee83
    f24c2c15b9d03797c6874986a8d1951634ec78fcc91ffb1e54cd85e4a09243327cef8a734855777c
    2a9d0caf42666e69b21afc54fb48d153c19101658f4a2a48a87deb01c5f539e6bda34829c8ef2368
    c68271a63ddbc431c307beb7d2918275852438d026c018c4307b916406f98c6274985f5115ad1492
    12a917dbef8ec801b21afc54fb48d153c19101658f4a2a480cc175b9c0f1b6a831c399e269772661
    f7bd60b75b29d79b660a2859395c1a2434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e8
    00b0cc9433830cf474b87337454200d4d33f80c4663dc5e5f7bd60b75b29d79b660a2859395c1a24
    0e9f1e8e40bb79e800b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e8
    00b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf4
    34ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf40e9f1e8e40bb79e8
    00b0cc9433830cf434ec78fcc91ffb1e54cd85e4a09243320e9f1e8e40bb79e800b0cc9433830cf4
    34ec78fcc91ffb1e54cd85e4a09243324124bc0a9335c27f086f24ba207a4912f7bd60b75b29d79b
    660a2859395c1a24f24c2c15b9d03797c6874986a8d1951634ec78fcc91ffb1e54cd85e4a0924332
    faf05c15dfad45dafd1fc23d5123685374985f5115ad149212a917dbef8ec801
    

    Explanation

    Memory GAP's instructions are md5 hashes of their actual instructions. Using ; as a delimiter, this is the "original" program:

    ;
    aaaa;size;dup;add;dup;add;dup;add;
    
    
    dup;open;pop;
    dup;
    
    dup;
    dup;
    aaaaa;size;dup;dup;dup;dup;add;add;add;dup;add;aaa;size;add;add;dup;aaaaa;dup;add;size;add;a;size;neg;add;
    btwn;
    
    swap;
    aaaa;size;dup;add;dup;add;dup;add;dup;dup;add;add;a;size;add;dup;aaaaa;size;add;btwn;
    add;
    
    a;size;swap;neg;add;
    open;
    pop;char;out;nil;shut;pop;
    
    a;size;add;
    dup;
    aaaa;size;dup;add;dup;add;dup;add;
    dup;dup;add;dup;add;aa;size;neg;add;btwn;
    shut;
    

    This simply iterates over the range between 32 and 126, and prints it if and only if it does not fall between '0' and '9' or 'a' and 'f'.

    Conor O'Brien

    Posted 2013-08-23T16:04:35.923

    Reputation: 36 228

    2

    Z80Golf, 83 bytes

    00000000: 2b2b 7036 092e 452c 453b 3b78 6f2c 4523  ++p6..E,E;;xo,E#
    00000010: 2323 2323 2323 2323 2323 2323 2323 2329  ###############)
    00000020: 2929 2929 2929 2929 307e 7620 2122 2425  ))))))))0~v !"$%
    00000030: 2627 282a 2d2f 3132 3334 3537 3839 3a3c  &'(*-/12345789:<
    00000040: 3d3e 3f40 4142 4344 7172 7374 7577 797a  =>?@ABCDqrstuwyz
    00000050: 7b7c 7d                                  {|}
    

    Try it online!

    Printable characters aren't too useful in z80, but we can write this:

       dec hl
       dec hl
       ld (hl),b
       ld (hl),9
       ld l,'E'
       inc l
       ld b,l
    
       dec sp      ; $0009 starts here
       dec sp
       ld a,b
       ld l,a
       inc l
       ld b,l
       inc hl
       inc hl
       inc hl
       inc hl
       inc hl
       inc hl
       inc hl
       inc hl
       inc hl
       inc hl
       inc hl
       inc hl
       inc hl
       inc hl
       inc hl
       inc hl
       add hl,hl
       add hl,hl
       add hl,hl
       add hl,hl
       add hl,hl
       add hl,hl
       add hl,hl
       add hl,hl
       add hl,hl
       jr nc, $+2+'~'
       halt
       db " !\"$%&'(*-/12345789:<=>?@ABCDqrstuwyz{|}"
    

    The idea is to print characters from 'F' to 'n', and put all the remaining characters in the code (the "garbage" string at the end).

    The preamble writes 09 (tab) to $fffe, so that we can point SP there to jump to $0009 after putchar. The ld (hl), b achieves nothing; I just get rid of 'p' there.

    L is initialized to 'E'+1, and counts up until (HL+17) << 9 overflows (sets the carry), which is when L is 111 = 'o', the first character we don't want to print.

    If the carry is not set, we jump over a halt instruction and the garbage string, into thousands of NOPs, the PC eventually running into putchar = $8000 and returning to $0009.

    See this answer for some more info on how this code prints characters in the first place.

    Lynn

    Posted 2013-08-23T16:04:35.923

    Reputation: 55 648

    nvm I saw that the code had to be printable as well. – qwr – 2018-06-20T19:16:58.957

    2

    Bash internals only, 133 bytes

    w=printf
    while IFS= read -r -n1 r;do i[$($w %d \'$r)]=1;done<$0
    for r in {33..126};do [[ 1 -ne ${i[$r]} ]]&& $w \\$($w "%o" $r);done
    

    Save and run with bash <filename>

    Explanation

    1. Make printf shorter.
    2. For each char r read from $0 (i.e. the script itself), set i[ord(r)] to 1.
    3. For each number r in range(33, 127), if i[r] is not 1, printf the char corresponding to the number r. The $w \\$($w "%o" $r) part is where the number-to-char magic is: convert the number to OCT, and then prepend a backslash, and finally feed to printf to really print it.

    The output is in ASCII order.

    ccsalvesen

    Posted 2013-08-23T16:04:35.923

    Reputation: 21

    1This would get my upvote with some explanation about how it works. – Stéphane Gourichon – 2015-03-19T19:37:23.863

    Actually I count 132. You can spare a few more characters: http://pastebin.com/G8YDBzJj – 113 characters.

    – manatwork – 2014-01-31T09:59:00.080

    2

    C++ 143

    #include<fstream>
    #include<iostream>
    char c[256],d,e=32;int main(){for(std::fstream i(__FILE__);i>>d;)c[d]++;for(;++e<127;)c[e]||std::cout<<e;}
    

    Alternative version using macros - 155

    #include"iostream"
    #define d int main(){while(s,*s)l[*s++]++;for(e=35;++e<127;)!l[e]&&std::cout<<e;}
    #define t(a)#a
    #define f(a)t(a)
    char*s=f(d),l[257],e;d
    

    And a version without 'reflection' (examining own source) - 139

    #include"iostream"
    char h['~'],*a="'()*+,:;<=[]acdefhilmnorstu{}",i='#';int main(){for(;*a;)h[*a++]++;for(;++i<'~';)if(!h[i])std::cout<<i;}
    

    mattnewport

    Posted 2013-08-23T16:04:35.923

    Reputation: 1 579

    2

    Bash, with coreutils, 80

    p=printf
    for o in {32..126};{
    c=`$p $($p "\%o" $o)`
    grep -qF "$c" $0||$p "$c"
    }
    

    Output is:

    !#&'}+,/45789:<>}@ABCDEGHIJKLMNOPQRSTUVWXYZ[]^_abhjklmsuvwxyz~
    

    Digital Trauma

    Posted 2013-08-23T16:04:35.923

    Reputation: 64 644

    Never heard about this for v in something; COMPOUND_CMD syntax. Great… – Arthur2e5 – 2016-03-02T08:13:30.257

    Just a grep replacement, but 5-bytes longer: [[ $(<$0) = *"$c"* ]] – Arthur2e5 – 2016-03-02T08:15:06.930

    only 3 bytes longer now: remove the double quotes – Arthur2e5 – 2018-02-19T00:04:31.127

    2

    Python 2, 62

    from string import*;print set(printable)-set(open("p").read())
    


    Code must be saved in a file called p.

    Lowest python solution so far ;D

    gcq

    Posted 2013-08-23T16:04:35.923

    Reputation: 251

    2

    PowerShell, 75 bytes

    [char[]](32..39+42+44+45+47+58..90+92+94..96+98+100..103+105..113+115..126)
    

    A different approach than the other PowerShell answer. Here, we manually build a list of ASCII values (...) that aren't in the source code, then cast that as a char-array [char[]]. PowerShell will by default write out values alone on a line like this, so we get printing for free.

    Characters used in code: ()+.0123456789[]achr

    AdmBorkBork

    Posted 2013-08-23T16:04:35.923

    Reputation: 41 581

    2

    Marbelous, 111 bytes

    @0
    --7E
    <XE\
    ../\@0
    :E\
    }0}0
    &0&1
    {0{>
    }0
    -F
    -E
    -5
    -4
    >0
    -7
    >D
    -F
    >0
    -2
    >0
    -2
    >0
    -3
    >3
    -2
    -6
    -8
    -9
    >0
    &0&1
    \/\/
    

    Main board loops from 0x7E down to 0x20, E\ function rejects values by decrementing and comparing to small numbers (Marbelous' built in < and > operators only work on the range 0-35).

    Sparr

    Posted 2013-08-23T16:04:35.923

    Reputation: 5 758

    1

    Ruby (50)

    puts (?#..?~).to_a.join.tr"()?!#.,~_aijnoprstu",""
    

    Outputs:

    $%&'*+-/0123456789:;<=>@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^`bcdefghklmqvwxyz{|}
    

    biinari

    Posted 2013-08-23T16:04:35.923

    Reputation: 11

    1

    Smalltalk - 47

    ^#DI,($ to:$~)difference:thisContext sourceCode
    

    This works in Squeak 6.x and produces the String:

    '!"%&''*+-./0123456789;<=>?@ABEFGHJKLMNOPQRSTUVWXYZ[\]_`abgjklmpqvwyz{|}'
    
    • ($ to:$~) forms a left String ranging the 95 characters
    • thisContext sourceCode produces a decompileString of the snippet
    • difference: reject all the caracters from the left String that appears in the decompileString.
    • #DI, which concatenates a Symbol with letters D and I to left String is here to make those 2 letters appear in code.
      It is necessary because the decompileString prefixes the snippet with DoIt ^ which is the name of the pseudo-method. Those letters will thus be removed.
      Same for the leading ^ that indicates to return the result, it is in the decompileString so has to be in the code even if optional
      Letters o and t are already in source code, so it's OK.
    • 'DI', would work but result string is printed with quotes ' so source must not have quotes
    • "DI" would be even shorter, unfortunately decompileString remove comments
    • We could eliminate method name with ($ to:$~)difference:(thisContext sourceCode last:52) but it is longer (52)

    The code consumes 25 different characters, and thus produces 70 different characters (among 73, quote ' appearing 3 more times for printing the String)

    aka.nice

    Posted 2013-08-23T16:04:35.923

    Reputation: 411

    1

    RProgN 2, 24 bytes

    {`{.` `~Rx={x\-`x=};x.}{
    

    Try it online!

    ATaco

    Posted 2013-08-23T16:04:35.923

    Reputation: 7 898

    1

    brainfuck, 126 bytes

    The polyglot that lists all the printable ASCII characters and prints nothing is shorter, but this uses only valid brainfuck commands and prints the rest.

    >+[-->---[-<]>]>+>++++++++++[<.+>-]+++++++++++++<+.+++>[<.+>-]>++++[<+++++++>-]<<+.++>[<.+>-]>++++[<++++++++>-]<+<+.++>[<.+>-]
    

    Try it online!

    KSmarts

    Posted 2013-08-23T16:04:35.923

    Reputation: 1 830

    1

    PHP, 80

    Compliant with current rules, I think, no loopholes anyway

    <?=join(array_diff(range(' ','~'),str_split(' \'(),;<=?\_acdefghijlnoprsty~')));
    

    Just gets the difference between the full set and the chars I used.

    Self Tests like this, if first and second line of output match, the first line is a valid solution

    <?=join(array_diff(range(' ','~'),str_split(' \'(),;<=?\_acdefghijlnoprsty~')));
    
    $used = count_chars(file(__FILE__)[0],3);
    $ascii = '!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~';
    $unused = str_replace(str_split($used), '', $ascii);
    
    echo "\n".$unused;
    echo "\n".$used;
    echo "\n";
    

    Umbrella

    Posted 2013-08-23T16:04:35.923

    Reputation: 867

    does neither use nor print the space character (0x20), but can be fixed without adding bytes. – Titus – 2018-05-17T16:36:40.923

    Good catch. Replacing ! with seems to resolve it. – Umbrella – 2018-05-18T13:24:46.690

    1

    A Pear Tree, 86 bytes

    `~1!2@3#4$5%6^7&8*9(0)-_=+[]{}\|;':",./<>?bcfhjklmnoqsuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
    

    It appears the only error message is "a partridge".

    Try it online!

    MD XF

    Posted 2013-08-23T16:04:35.923

    Reputation: 11 605

    1

    Flipbit, 369 bytes

    ^>>>>>.^.^<^>.^.^<^<^>>.^.^<^>.^.^<^<^<^>>>.^.^<^>.^.^<^<^>>.^.<^>.>^<[^<]^>>>>.^.^<^>.^.^<^<^>>.^.^<^>.^.^<^<^<^>>>.^.^<^>.^.<^<^>>.<^>.<<<<^>^>^>^>^>.^.<^>.^.^<^<^>>.^.^<^>.^.^<^<^<^>>>.^.^<^>.^.^<^<^>>.^.^<^>.^.<<<<^>>>>.<^>.^.<<^>^>^.^.<^>.^.<<<^>>>.^.<^>.^.<<^>^>.<^>.^.<^>.<<^<<^<^>>>>>.^.<^>.^.<<^>>.^.<^>.^.^<<^<^>>>.^.<^>.^.<<^>>.^.<^>.^.<^>[^<].<<<<^>>>^.<^>.
    

    Try it online!

    Assumes that the output can contain characters outside the ASCII range, so here is a hexdump:

    00000000: 2021 2223 2425 2627 2829 2a2b 2c2d 2f30   !"#$%&'()*+,-/0
    00000010: 3132 3334 3536 3738 393a 3b3d 3f41 4042  123456789:;=?A@B
    00000020: 4344 4546 4748 494a 4b4c 4d4e 4f5f 5d5c  CDEFGHIJKLMNO_]\
    00000030: 5b5a 5859 5150 5253 5557 5654 6061 6362  [ZXYQPRSUWVT`acb
    00000040: 6667 6564 6968 6a6b 6f6e 6c6d 7071 7273  fgedihjkonlmpqrs
    00000050: 7475 7677 7879 7a7b 7d7f c0c1 c3c2 c5c4  tuvwxyz{}.......
    00000060: c7c6 c9c8 cbca cdcc cfce dedc ddda dbd9  ................
    00000070: d8d0 d1d3 d2d4 d6d7 d5e1 e0e2 e3e7 e6e4  ................
    00000080: e5e8 e9eb eaee efed ec7e 7c              .........~|
    

    Don't you dare ask me how it works. As this (ab)used a bug which has no been fixed, test with this commit.

    caird coinheringaahing

    Posted 2013-08-23T16:04:35.923

    Reputation: 13 702

    1

    Python, 94

    print !"#$%&'90*+,-.0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[/\]^_`abcdefghjklmoqsuvwxyz{|}
    

    Timtech

    Posted 2013-08-23T16:04:35.923

    Reputation: 12 038

    1

    The "do nothing" solution was already posted.

    – Joe Z. – 2013-11-27T22:15:46.657

    @JoeZ. I've changed it to do something – Timtech – 2013-11-28T12:06:16.593

    1

    Perl 5, 66 bytes

    $s=q{$_=chr,"\$s=q{$s};eval\$s"!~/\Q$_/&&print for 32..126};eval$s
    

    Try it online!

    Dom Hastings

    Posted 2013-08-23T16:04:35.923

    Reputation: 16 415

    1

    Stax, 12 bytes

    Vp.."-"Vp-"-
    

    Run and debug online!

    Added for completeness, feel free to mark it as non-competing if necessary.

    Vp in Stax is the set of all printable ASCII characters, .." is the two character string literal (of .") in Stax.

    Weijun Zhou

    Posted 2013-08-23T16:04:35.923

    Reputation: 3 396

    1

    Japt, 20 bytes

    #[o_d#$ k"[o_d$k1!"1
    

    Try it online!

    How it works

    #[o_d#$ k"[o_d$k1!"1
    
    #[o                   Map range(91) with...
       _d#$                 Apply chr(n+36)...
            k"[o_d$k1!"     and remove these chars from it...
                       1    in case sensitive mode.
                          Implicit output (result is Array; comma-joined)
    

    Dealing with the quotes turned out to be nasty, so I reduced the range to start at $ (36) instead of (32).

    Bubbler

    Posted 2013-08-23T16:04:35.923

    Reputation: 16 616

    1

    Ruby, 46, 37

    puts (?!..?~).to_a-IO.read($0).chars
    

    Creates a range of characters from ! to ~, reads the current file and subtracts the characters in the current file from the range, then prints them all out.

    Inspiration from prior Ruby post of Doorknob.

    Julian Knodt

    Posted 2013-08-23T16:04:35.923

    Reputation: 41

    1

    PHP, 70 bytes

    for($c=31;++$c<127;)count_chars(file(__FILE__)[0])[$c]||print chr($c);
    

    PHP, 80 bytes

    <?=join(array_diff(range(" ","~"),str_split(count_chars(file(__FILE__)[0],3))));
    

    Try them online.

    Require PHP 5.4 or later (released 2012-03-01) for indexing the function result.

    Titus

    Posted 2013-08-23T16:04:35.923

    Reputation: 13 814

    1

    T-SQL, 79 bytes:

    PRint upper('abcdefghijlkmnoqstuvwxyz')--!"#$%&*+,./0123456789:;<=>?@[\]^_`{|}~
    

    Kinda cheaty, everything after -- is a comment.

    Less cheaty, much longer (143 bytes):

    WITH UX AS(SELECT 33D union ALL SELECT D+1FROM UX WHERE D<126)
    select CHAR(D)from UX where charindex(char(D),'acdefhilmnorstuwx()+<,''=01236')=0
    

    Must be run on a case-insensitive database. This uses a recursive number table to generate values from 33 to 126, and displays the CHAR() of each, excluding any that are in a string (that simply re-lists all characters used elsewhere in the code).

    SQL keywords are not case-sensitive, so I vary the case to cover both upper and lower of each letter used. CHARINDEX on a case-insensitive database then excludes both the upper and lower of each in the string, saving me some characters.

    BradC

    Posted 2013-08-23T16:04:35.923

    Reputation: 6 099

    1

    Python 3, 65

    print(''.join(set(map(chr,range(32,127)))-set(open('q').read())))
    

    Name the file 'q'. Run with python3 q. If 'q' is an unacceptable filename the file can be named '.py' for an additional 2 characters.

    Mr. Wizerd

    Posted 2013-08-23T16:04:35.923

    Reputation: 11

    reading own source code is boring. – qwr – 2018-06-20T04:30:58.830

    1

    Ruby, 46 bytes

    $><<([*?%...?~]-"#%><chars.[*?!-]()".chars)*""
    

    Try it online!

    G B

    Posted 2013-08-23T16:04:35.923

    Reputation: 11 099

    1

    Powershell, 60 bytes

    Inspired by Iszi's answer. See also AdmBorkBork's answer with another approach.

    $t=gc(gv My* -v|% I*e)|% t*y
    [char[]](32..126)|?{$_-notin$t}
    

    where:

    • gv My* -v is alias and shortcut for Get-Variable MyInvocation -Value.
    • |% I*e is shortcut for |% InvocationName.
    • |% t*y is shortcut for |% ToCharArray.
    • and first line means: store to the variable $t a char array that is read from a file with a name that is taken from the properties of the current script.

    mazzy

    Posted 2013-08-23T16:04:35.923

    Reputation: 4 832

    1

    Japt, 13 bytes

    Bah! Stoopid k and its stoopid case-insensitivity costing me 2 bytes!

    ;EkQ+"+QkE;"E
    

    Try it

    Shaggy

    Posted 2013-08-23T16:04:35.923

    Reputation: 24 623

    1

    Perl 6, 59 56 bytes

    say [~] keys (" ".."~") (-)"say o(\\\".~)-cmbkey[]".comb
    

    Try it online!

    bb94

    Posted 2013-08-23T16:04:35.923

    Reputation: 1 831

    you didn't update the TIO link – ASCII-only – 2019-04-15T01:12:23.480

    Updated the link, thanks – bb94 – 2019-04-15T02:18:28.850

    1

    Clam, 14 bytes

    pE'a-"pE'a-\""
    

    Just performs a diff between all printable ASCII character and the few unique chars in this program.

    Explanation

    pE'a-"pE'a-\""
    p              - Print...
      'a-          -   Printable ASCII range
     E             -   That isn't found in...
         "pE'a-\"" -   The characters used in this program
    

    Skidsdev

    Posted 2013-08-23T16:04:35.923

    Reputation: 9 656

    Hm, does this remove \ from the printable ASCII character set? – Erik the Outgolfer – 2019-05-03T20:41:13.977

    1

    VTL-2, 194 bytes

    33 ~=#-1
    51 ~=~+1
    53 #=51*((~=35)+(~=(35+1))+(~=(35+5))+(~=(35+5+1))+(~=(35+5+1+1))
    55 #=51*((~=(35+5+3))+(~=(35+5+5))+(~=(51-1-1))+(~=51)+(~=53)
    111 #=51*(55+5+1=~
    113 $=~
    115 #=51*(1-(~=(115+5+5
    

    Prints !"%&',./0246789:;<>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}. It's about double the length of the comment approach, but much more interesting. I had to use some digits, and restricting it to 1, 3, and 5 seemed to work the best... though I haven't proven this. Line-by-line explanation:

    33: Assigns the variable ~ to the current line number (#) less 1. Originally I was going to use ! and be able to start printing from 34 on, but... ! is a system variable.

    51: Increments the value in ~

    53, 55, 111: These all basically say IF ~ == 35 OR ~ == 36 OR ~ == 40 [...] GOTO 51. VTL relies heavily on system variables. # is the line number variable - as in line 33, we can pull the value of the current line number, but if we assign a value to #, it's a GOTO. The initial #= is this assignment, everything else is evaluation. Any given ~=35 type evaluation returns one for true (equality) or zero otherwise. We do as many of these as fit in a line (72 characters), sum them, and multiply this by our target line number. If any of those evaluations were true, we end up with #=51; if not, we end up with #=0, essentially a NOP.

    113: Output character corresponding to code point.

    115: Same sort of GOTO construction as above, except we're looping back IF ~ != 125. So, first we have to see if ~ does equal 125, then subtract that from 1 to make it a NOT.

    Keeping in mind the line length restrictions, the lazy commented version comes in at 93 bytes:

    12340 )"#$%&'(*+,-./:;<=>?ABCDEFGHIJKLMNOPQRSTU!
    56789 )VWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~@
    

    ...although I can't actually enter this because the @ chokes it. And now I know why: "At any time before hitting Return, the entire line may be erased by typing the At-signcharacter ‘@’ (Shift-P or “Cancel” on some terminals.)". So the non-printing commented version is purely theoretical, and some code would have to be written to at least print the @... which would mean code to print the characters used in that code, etc...

    brhfl

    Posted 2013-08-23T16:04:35.923

    Reputation: 1 291

    1

    Perl 6, 43 bytes

    <say |keys (" "..<~>) (-).comb#EVAL>~~.EVAL
    

    Try it online!

    Uses the standard Perl6 quine format.

    Jo King

    Posted 2013-08-23T16:04:35.923

    Reputation: 38 234

    1

    Ruby 2.1.0

    206 204 characters

    chars_in_source = File.read("self.rb").chars.uniq.map(&:ord)
    printable_ascii = (20..126).to_a
    not_in_source = printable_ascii.reject { |c| chars_in_source.include?(c) }
    
    puts not_in_source.map(&:chr).join
    

    And the output is:

    #$%'*+,-/345789;<>@ABCDEGHIJKLMNOPQRSTUVWXYZ[\]^`gkvwxyz~
    

    Not the shortest here (in fact, it might be the longest). But that's the great thing about this: it got me to go try something I'd never done before.

    ahuth

    Posted 2013-08-23T16:04:35.923

    Reputation: 111

    VariableNamesGreaterThanOneCharacterLongException on line 1 – CalculatorFeline – 2016-03-02T04:38:12.010

    1

    Python, 88 81 78 77 bytes

    actually reads the file

    I tried to do it the 'clean' (as in 'easy to read') way, turned out quite nice, although i'm still new to python and probably this can be shortened as well.

    file named 'a' is the file executed.

    from string import*
    for c in printable:
        if c not in open('a').read():print c
    

    And it prints out all the ASCII characters not found in source file. I know this was supposed to be a clever hack (as in all those which contain all the ascii set or addresses, or use an error), but I wanted to do explicitly what was asked :]

    Anyone has a suggestion how to make it even shorter while still going in this direction?

    [edit] trimmed one more char, thanks for the tip!

    Taku

    Posted 2013-08-23T16:04:35.923

    Reputation: 37

    1

    Timtech's tip makes possible to reduce 1 more character.

    – manatwork – 2014-01-31T12:30:07.603

    1

    Javascript 78 chars

    bghjklm()seuABCDEFGHIJKLMNOPQRSTUVWXYZvwyz!@#$%^&*1234567890{}[]-=_+\;"'.,<>/?
    

    Outputs:

    SyntaxError: Unexpected identifier
    

    Not the shortest code, but threw a try for fun. Notice the colon (:) and space () are covered in Output also.

    Feedback appreciated.

    Gaurang Tandon

    Posted 2013-08-23T16:04:35.923

    Reputation: 837

    And I just notice now that @xem has already done something similar to my code. Sorry, at CodeGolf people (and xem), if you all consider what I did unknowingly is copying another's work, I will happily delete my answer. – Gaurang Tandon – 2014-01-31T14:54:56.313

    1

    PYG 0.1 (17):

    P(*Se(STP)-Se(Q))
    

    prints

    $
    ,
    0
    4
    8
    <
    @
    D
    H
    L
    X
    \
    `
    d
    h
    l
    p
    t
    x
    |
    
    
    #
    '
    +
    /
    3
    7
    ;
    ?
    C
    G
    K
    O
    W
    [
    _
    c
    g
    k
    o
    s
    w
    {
    "
    &
    .
    2
    6
    :
    >
    B
    F
    J
    N
    R
    V
    Z
    ^
    b
    f
    j
    n
    r
    v
    z
    ~
    
    
    !
    %
    1
    5
    9
    =
    A
    E
    I
    M
    U
    Y
    ]
    a
    i
    m
    q
    u
    y
    }
    

    Not the shortest, but it gets the job done. Also, since I just created this "Language" (it's actually shortend Python), I'll explain what it does.

    • Q gives the program's code
    • STP gives all printable characters
    • Se is equal to Python's set
    • - substracts the two sets
    • * is also the same as python's
    • P prints it.

    Knowing this, this would convert to the following python: for i in set(__import__("string").printable)-set(open(__file__).read()): print i

    ɐɔıʇǝɥʇuʎs

    Posted 2013-08-23T16:04:35.923

    Reputation: 4 449

    1

    Befunge, 44 characters

    tested in http://www.bedroomlan.org/tools/befunge-93-playground

    $#~"01g`!#@_:01>g#1-#0*#:_!> #,!#g!_01g1+01p
    

    it has exactly one quotation mark in the code, so that whenever it is executed, the program enters string mode, reading the code until it loops back to the same quotation mark, stops string mode and continues execution.

    it does this for every printable ascii character, rejects it if it's in the code and continues. maybe i'll golf it more later

    proud haskeller

    Posted 2013-08-23T16:04:35.923

    Reputation: 5 866

    1

    J, 24 bytes

    Another J solution in 24 characters:

    '''{a.239-'-.~93{.32}.a.
    
    • a. is the alphabet, this is, character 0 to 255 where some characters are replaced with box-drawing characters.
    • 32}.a. drops the first 32 characters of a. (the box-drawing and control characters)
    • 93{.32}.a. takes the first 93 characters of what remains. That is, ASCII characters 32 to 126. We don't take the tilde ~ or the closing curly brace } because they are part of the program.
    • '''{a.239-'-.~94{.32}.a. removes the set of the characters '{.a239- (the remaining ASCII characters that are part of the program) from the character set generated in the previous step, yielding all ASCII characters that are not part of this program.

    FUZxxl

    Posted 2013-08-23T16:04:35.923

    Reputation: 9 656

    1

    CBM BASIC v2.0 - 63

    0fori=84+5to127.
    3?chr$(i);:next
    6rem "!#%&'*,-/<>@abdgjklmpqsuvw
    

    Psychonaut

    Posted 2013-08-23T16:04:35.923

    Reputation: 233

    1

    Perl 6, 41 bytes

    say [~] keys (' '..'~') (-)$*PROGRAM.comb # 41 bytes
    
    IYZnCpl?W8|}K!^i"`Bhuvw6F<\S,=JrVLQE54%Xqg_1{/3+Tjx#Ht&;7>02@ND:9Udfz
    

    The reason the order of the output is random is that the Set Minus operator (-) produces a Set, which is inherently unordered.

    Brad Gilbert b2gills

    Posted 2013-08-23T16:04:35.923

    Reputation: 12 713

    1

    Javascript/coffeescript/actionscript/more, 96

    // #qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890~`!@$%^&*()-_=+[{]}\|;:'",<.>?
    


    Other languages it works in are basically anything with // comments (and doesn't need something like class a{public static void main(String[]a){) This also works in Perl 5 (Thanks @BradGilbertb2gills for pointing that out!)

    ev3commander

    Posted 2013-08-23T16:04:35.923

    Reputation: 1 187

    I was just about to comment that this would work in almost any language... – Sparr – 2015-11-18T23:47:11.270

    >qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890~`!@/$%^&*()-_=+[{]}|;:'",<.>? Python - 95 bytes EDIT: Damn code blocks< – DJgamer98 – 2015-11-19T14:59:38.080

    If you placed the # character before qwerty then it will also work in Perl 5. – Brad Gilbert b2gills – 2015-11-29T19:16:00.307

    @BradGilbertb2gills cool! – ev3commander – 2015-11-29T21:17:57.877

    Perl 5 will either see // as a null regex, or a defined-or operator. (say undef // 1) I'm not sure which. ( If it is the latter, it may only work on 5.10 or newer ) – Brad Gilbert b2gills – 2015-11-29T21:41:07.693

    1

    ><>, 86 bytes

    Naive implementation : for each character in the 0x20 - 0x7e range, browse its codespace until it reaches the character or the end of the codespace.

    ' 'v1+>}:{:@@g:?!v{:}=?v30.
    >  >00^   0+1v!?~<
    ^+1;?='~':<          ~~<
    ~:o       ^  >
    

    Output :

    "#$%&()*,-/2456789ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]_`abcdefhijklmnpqrstuwxyz|
    

    This is definitely golfable, I'll try to improve the flow control later.

    Aaron

    Posted 2013-08-23T16:04:35.923

    Reputation: 3 689

    1

    Lua, 94 bytes

    f="l=...for i=32,126 do c=string.char(i)io.write(l:find(c,0,1)and\"\"or c)end"loadstring(f)(f)
    

    Writes the algorithm in a string and uses loadstring to run it as a function passing in its string definition as the argument.

    Blab

    Posted 2013-08-23T16:04:35.923

    Reputation: 451

    Hello, and welcome to Programming Puzzles and Code Golf! Great answer! – NoOneIsHere – 2016-05-10T23:25:38.000

    0

    QBIC, 61 bytes

    [32,126|B=chr$(a)~instr(A,B)|\?B}##$(),1236=?ABB[\achinrst|}~
    

    Are we allowing new languages on old challenges yet?

    Explanation

    [32,126|      FOR a = 32 TO 126
    B=chr$(a)       Set B$ to the char code a
    ~instr(A,B)   IF A$ contains B$
    |             THEN do nothing
    \?B}          ELSE print B$
    #             Define a literal A$ that has every char in this program once.
     #$(),1236=?ABB[\achinrst|}~
    

    Usually, QBIC would delimit a literal with a backtck ('`'), so that's the one char we can't have in a literal. However, the backtick is auto-added on open literals at EOF.

    steenbergh

    Posted 2013-08-23T16:04:35.923

    Reputation: 7 772

    0

    PHP, 81 bytes

    <?php $w=file(__FILE__)[0];foreach(range(' ','')as$i){echo!strpos($w,$i)?$i:'';}
    

    Shortest by-the-book PHP submission so far, built upon @michal.hubczyk 's answer with a few golf twists. Interestingly enough, adding the <?php prolog saves some bytes off the whole solution, thanks to the use of file()[0] modern php array-dereferencing on the one-liner file instead of the classic file_get_contents().

    Try it online!

    Calimero

    Posted 2013-08-23T16:04:35.923

    Reputation: 131

    0

    Brain-Flak, 155 bytes

    Includes +1 for -A

    ((((((()()()()){}){}){})<>[()()()])[()])((((()()()){})){}{})<>((()()()()){}){({}[()]<(({})())>)}{}({}()())<>{{({}<>[()]<(({})())><>)}{}<>(({}())()())<>}<>
    

    Try it online!

    # Push 32 on this stack and 18, 28 and 29 to the other
    # 18, 28 and 29 are the distances between the sets of braces 
    ((((((()()()()){}){}){})<>[()()()])[()])((((()()()){})){}{})<>
    
    # For 0 to 8
    ((()()()()){}){({}[()]<
    
        # Push TOS, TOS + 1
        (({})())
    
    # end For 0 to 8
    >)}{}
    
    # Push TOS + 2 
    # skips '(' and ')'
    ({}()())
    
    # For each value on the off stack (18, 28, 28)
    <>{
    
        # For 0 to that number
        {({}<>[()]<
    
            # Push TOS, TOS + 1
            (({})())
    
        # End for 0 to that number
        ><>)}{}
    
        # Push TOS + 1, TOS + 3 (skips this set of braces)
        <>(({}())()())<>
    
    # End for each value on the off stack (18, 28, 28)
    }<>
    

    Riley

    Posted 2013-08-23T16:04:35.923

    Reputation: 11 345

    0

    MATLAB/Octave, 45 44 41 bytes

    setdiff([33:126 ''],'setdif([3:126''],)')
    

    Try it online!

    Tom Carpenter

    Posted 2013-08-23T16:04:35.923

    Reputation: 3 990

    0

    JavaScript, 96

    eval(l="for(e=32,x='';e<127;e++)v=eval('\"\\\\x'+e.toString(16)+'\"'),x+=-1==l.indexOf(v)?v:''")
    

    user2428118

    Posted 2013-08-23T16:04:35.923

    Reputation: 2 000

    0

    JavaScript: (96 bytes long, prints nothing, throws an error)

     !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
    

    or

    Valid JavaScript (97 bytes long, prints nothing)

    ' !"#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'
    

    xem

    Posted 2013-08-23T16:04:35.923

    Reputation: 5 523

    0

    Brainfuck, 95 bytes

    [ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\^_`abcdefghijklmnopqrstuvwxyz{|}~]
    

    The way this works is pretty simple, any decent Brainfuck interpreter will ignore the code between the brackets appearing at the start of source file, therefore creating a comment.

    Krzysztof Szewczyk

    Posted 2013-08-23T16:04:35.923

    Reputation: 3 819

    0

    F# - 66

    Set.iter(printf"%c")(set[' '..'~']-set"Set.ir(pnf\"%c)s[' ~]-\\")
    

    mattnewport

    Posted 2013-08-23T16:04:35.923

    Reputation: 1 579

    0

    Javascript 94

    a="",r="for(v=32;v<128;)c=String.fromCharCode(v++),a+=r.indexOf(c)<0?c:\"\"; alert(a)";eval(r)
    

    mattnewport

    Posted 2013-08-23T16:04:35.923

    Reputation: 1 579

    0

    PHP (110 characters)

    <?php
    $w=file_get_contents(__FILE__);
    $i=32;
    while ($i++<126)
    echo(strpos($w,chr($i))===false)?chr($i):'';
    

    michal.hubczyk

    Posted 2013-08-23T16:04:35.923

    Reputation: 121

    0

    Ruby, 43 characters

    $><<([*' '..?~]-open($0).read.split(''))*''
    

    Output:

    !"#%&+,/123456789:;=@ABCDEFGHIJKLMNOPQRSTUVWXYZ\^_`bcfghjkmquvwxyz{|}
    

    user4740

    Posted 2013-08-23T16:04:35.923

    Reputation:

    0

    k4 (31)

    -1 x@&~(x:"c"$32+!95)in*0:.z.f;
    

    save in a file, name doesn't matter (except that the extension has to be .k), and run with q.

    $ q aq.k 2>/dev/null
    #%',/4678<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abdeghjklmopqrstuvwy{|}
    

    works by getting the name of current script file, reading it, removing its contents from the list of all printable ascii, and printing what's left.

    if we dispense with the trailing newline in the printout, we can save one character (the - at the beginning of the code)

    Aaron Davies

    Posted 2013-08-23T16:04:35.923

    Reputation: 881

    0

    PHP - 99 Characters

    echo implode('',array_diff(array_map('chr',range(33,126)),str_split(file_get_contents(__FILE__))));
    

    Steve Robbins

    Posted 2013-08-23T16:04:35.923

    Reputation: 183

    0

    Hassium, 129 Bytes

    This one is a bit more unique than some of what I've seen. It reads the program's source into a variable then iterates of the ASCII table.

    To run you must save your code in a file called "f".

    use IO;func main(){f=File.readText("f");for(c=0;c<128;c++){c=Convert.toChar(c);g=1;foreach(d in f)if(c==d)g=0;if(g==1)print(c);}}
    

    Run and see expanded here

    Jacob Misirian

    Posted 2013-08-23T16:04:35.923

    Reputation: 737

    0

    Microscript II, 82 bytes

    Well, that's just ridiculous.

    ( %&'*+,-./12345789:<=>?@ABCDEFGHIJKLMNORSTUVWXYZ\^_`bcdghijkmovwxyz{|}~)P6;q!p#Q$
    

    One ridiculously long unexecuted conditional, followed by the commands P6;q!p#Q$.

    Output:

    null
    "false"true"0"
    []
    

    SuperJedi224

    Posted 2013-08-23T16:04:35.923

    Reputation: 11 342

    0

    Groovy, 90 78 bytes

    (32..126).each{print'(32.16)each{print\'\\dxOf+?:}'.indexOf(it)+1?'':(char)it}
    

    K. Klassen

    Posted 2013-08-23T16:04:35.923

    Reputation: 121

    0

    Mouse-2002, 105 95

    $!"#%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
    

    Contains a bunch of unprintables; hexdump (reversible with xxd -r):

    Does nothing, and is not a comment; it just so happens everything after $ is ignored.


    A real answer would start like

    zh+i:(i.127<^i.!'i.b+i:)
    

    But you'd need a lot of if-statements and it would just get ridiculously long.

    cat

    Posted 2013-08-23T16:04:35.923

    Reputation: 4 989

    "is not a comment, ... everything after$ is ignored." Pretty sure that's the definition of a comment – MD XF – 2017-11-17T19:19:16.653

    1@MDXF no, it is the end of the program – cat – 2017-11-18T18:23:10.500

    0

    Pyke, 34 bytes, noncompeting

    "!$%&'()*+[,.]/:<=>?@^_`{|}";~J\J-
    

    I'm going the no-op, print chars route

    Try it here!

    Blue

    Posted 2013-08-23T16:04:35.923

    Reputation: 26 661

    0

    Mathematica 71 bytes

    Taking as the range of "printable" characters ASCII 32-126, this takes the complement of the full set of characters (CharacterRange[32, 126]) and the used set of characters ("Charactes@Rngplm[32,16]").

    Complement[CharacterRange[32, 126],Characters@"Charactes@Rngplm[32,16]"]
    

    {"!", "#", "%", "^", "&", "*", "(", ")", "_", "-", "+", "=", "~", "`", "{", "}", "|", "\", "<", ">", ".", ";", "\"", "?", "'", "/", ":", " ", "0", "4", "5", "7", "8", "9", "A", "b", "B", "d", "D", "E", "f", "F", "G", "H", "i", "I", "j", "J", "k", "K", "L", "M", "N", "o", "O", "P", "q", "Q", "S", "T", "u", "U", "v", "V", "w", "W", "x", "X", "y", "Y", "z", "Z", "$"}

    DavidC

    Posted 2013-08-23T16:04:35.923

    Reputation: 24 524

    0

    Perl6, 66

    (63..96)>>.chr.join.print #!"$%&/+-*:;<=0124578abdefghklmqsuvwxyz'
    

    bb94

    Posted 2013-08-23T16:04:35.923

    Reputation: 1 831

    0

    ISOLADOS, 7369 bytes (non-competing)

    ISOLAADOOS ISOLAAAAAAADOS ISOLAADOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOOOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOOOOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOOOOOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOOOOOOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOOOOOOOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOOOOOOOOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOOOOOOOOOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOOOOOOOOOOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOOOOOOOOOOOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOOOOOOOOOOOOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOOOOOOOOOOOOOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOOOOOOOOOOOOOOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOOOOOOOOOOOOOOOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOOOOOOOOOOOOOOOOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOOOOOOOOOOOOOOOOOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOOOOOOOOOOOOOOOOOOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOOOOOOOOOOOOOOOOOOOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOOOOOOOOOOOOOOOOOOOOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOOOOOOOOOOOOOOOOOOOOOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOOOOOOOOOOOOOOOOOOOOOOOOS ISOLAAAAAAADOS ISOLAAADOS ISO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OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOS ISOLAAAAAAADOS ISOLAAADOS ISOLAADOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOS ISOLAAAAAAADOS ISOLAAADOS
    

    acrolith

    Posted 2013-08-23T16:04:35.923

    Reputation: 3 728

    1link to interpreter or something? – Destructible Lemon – 2017-05-31T23:21:05.720

    Link to interpreter or something? – MD XF – 2017-11-17T19:18:01.487

    -1

    SmileBASIC, 78 63 bytes

    FOR I=32TO 126?CHR$(I)*(INSTR(LOAD("TXT:_",0),CHR$(I))<0);
    NEXT
    

    Assumes the program is saved in a file named _ (which sounds like cheating to me but apparently this is ok)

    12Me21

    Posted 2013-08-23T16:04:35.923

    Reputation: 6 110

    -2

    Groovy: 52 chars

    print(((' '..'~')-new File('a').text.grep()).join())
    

    // print all characters from '#' to '~', except those present in the file itself (the name of the source file is 'a').

    br2000

    Posted 2013-08-23T16:04:35.923

    Reputation: 107

    Why the downvote ? – Stéphane Gourichon – 2015-03-19T19:38:51.007

    1@StéphaneGourichon because it's assuming that file a has all the missing characters in it. This solution exploits a common loophole, and is therefore invalid. – Magic Octopus Urn – 2017-08-03T14:52:34.370

    @Magic Octopus Urn - No. The file 'a' is the name of the program itself. The program simply reads itself, and then removes all the characters it contains from the specified range of characters. – br2000 – 2017-08-10T11:41:34.220