text:
Tips for golfing in Postscript?
As one of the less popular languages, it's difficult to find literature on the avant garde of postscript hackery. So what discoveries have the golfers here made to exploit the stack model (or other features) to overcome Postscript's inherent verbosity?

Found some external pages: https://sites.google.com/site/codegolfingtips/Postscript

While most postscript operators are syntactically identifiers (and therefore must be space- (or otherwise-) delimited), the names [, ], <<, and >> are self-delimiting and scanner will detect them without intervening space. For the same reason, you cannot refer to these names with the usual /literal syntax (eg. /[ is two tokens: an empty literal name equivalent to ()cvn cvlit, and the executable name [ equivalent to ([)cvn cvx exec).
In order to redefine these names, which cannot be mentioned by name, we can use strings which are implicitly converted to names when used as keys in a dictionary (convenient!).
This example illustrates abusing these operators to perform arithmetic.
%!
([)0 def
(])1 def
(<<){add}def
(>>){mul}def
 ]]<<]]]<<<<>> =
%1 1 add 1 1 1 add add mul = %prints 6

Also << and [ (and mark) all mean the same thing.

My own postscript interpreter, xpost, also makes the right-curly brace available with some restrictions. discussion

Also, / ends the previous token so you don't need a space before it.

Embedded Decoder
A Postscript program has a unique(?) ability to read it's own program text as data. This is normally used by the image operator which receives a data-acquisition-procedure as input, and this procedure often uses currentfile followed by readline, readstring, or readhexstring. But seen another way, image is just another looping operator, so any loop can read-ahead. An example is the line-printer emulator from the Green Book.
Using the token operator invokes the scanner on a file or string, pulling off a number or space- (or otherwise-: see other answer) -delimited name.
A simple PS interpreter in PS:
{currentfile token not {exit} if dup type /arraytype ne {exec} if }loop

Binary Operator String Decoder
Since I can't seem to get raw binary tokens to work for me (see other answer), I've made use of the "embedded decoding" idea to exploit the binary token mechanism to pack code into 8-bit strings, and then manipulate and parse the commands from the string on the fly.
/.{
    <920>  % two-byte binary-encoded name template with 0x92 prefix
    dup 1 4 3 roll put  % insert number into string
    cvx exec  % and execute it
}def
/${
    //.   %the /. procedure body defined above
    73 .  %"forall" (by code number)
}def

The . procedure takes a number from the stack and inserts it as the second byte in a two-byte string, the first byte being the prefix-byte for a binary token, specifying an executable system name. We save a byte in the hexstring by using a rule of the scanner that an odd number of nibbles in the hexstring is padded with an extra 0 nibble, so 3 hex nibbles produces a 2-byte string. The string is then marked executable and called with exec which invokes the scanner, produces the desired executable system name, and then loads the name and executes the operator. The $ does this on each byte of a string on the stack, using the . procedure twice, once as the loop body, and then to execute the looping operator forall by number.
More compactly, these procedures look like this:
 /.{<920>dup 1 4 3 roll put cvx exec}def/${//. 73 .}def
%123457890123456789012345678901234567890123456789012345
%        1         2         3         4         5

So, 55 chars buys binary token strings. Or, for 6 (maybe 7, if you terminate it with a space) chars, you can load the G library with (G)run which defines . and $ as above (+ a few others to extend the range of ascii-reachable codes).
Further illustrated in my crossword puzzle answer.

Actually, if the postscript is in encoded form, then this requires you be extra careful about comparing stuff.  Specifically, if you are looking at operators, you must parse it as a token and then compare the token's name to the target value.

Here's a quickie: wrap multiple definitions in [...>>begin to eliminate the keyword def (nb. [ is the same as <<).
 def def
[>>begin

So remember: more than three two ... flock together! ;)

Shouldn't the rule be "more than two"? Compare /a 1 def/b 2 def/c 3 def with <</a 1/b 2/c 3>>begin. We need more spaces for def.

Wow. I hadn't though of that. Yes, the calculation needs improvement.

Actually, this should be [/a 1/b 2/c 3>>begin

face-palm. . . .

I've got some new ideas described in the chatroom

Sorry, I don't see anything there. Am I doing something wrong?

I guess it scrolled away. I've got a start on a golfing library and a suite for APL-like calculations.

This might not apply if you are naming something that terminates on a self-delimiting token. In /a{pop 2 mul}def or \b[2 3]def, the def only costs 3 characters, not 4.

Replace hexstrings with ASCII85
Probably old news, but I just learned it. :)
You can do it using the postscript interpreter interactively with an encoding filter and cut-and-paste. But I'm going to show how to use dc to do it "by hand".
So, here's a hex string. We split it into 4-byte chunks.
95 20 6e d8   d0 59 49 35   50 74 ba c5   08 2d

Firing up dc, we input these as 32-bit (unsigned) big-endian-byte-order numbers. Then mod-off base-85 digits (there should be 5 until you get to 0).
0> dc
16i
95206ED8
Ai
d85%n85/
82
d85%n85/
83
d85%n85/
82
d85%n85/
78
d85%n85/
47
d85%n85/
0

Padding the last chunk with 00 00, yields (decimal), omitting the same number of bytes that we padded.
47 78 82 83 82   66 81 72 79 83   25 72 82 25 69  2 53 30 [2 53]

Add 33 to shift into the printable range of ASCII and poof! ASCII85.

  80 111 115 116 115 99 114 105 112 116 58 105 115 58 102 35 86 63
 which decodes to:
  Postscript:is:f#V?

  %%%Oops! should say 'fun'! I screwed up somewhere. :)

Wrap it in <~ ... ~>, and Level-2 Postscript can access 8-bit data, cheaper than hex.

Please could you explain how to use the interpreter to ASCII85 encode data? I don't yet understand how to use filters and that would really help.

You can use /f (%stdout)(w)file /ASCII85Encode filter def and then write data into the "file" (ie. filtered file) f.

Thanks! And, so I don't forget, you can then use it like this: f (testing 123) writestring f closefile

When generating graphical output and console output does not matter, use = instead of pop.

Factor-out repeated uses of long operator names
If you're already using a <<>>begin dictionary, there is a constant overhead of /?{} 4 characters per redefinition. So an operator of length n repeated N times will yield a character-count change of
(4 + n) - (N * (n - 1)).
Setting this formula equal to 0 gives the equation of the break-even point. From this we can solve for each variable in terms of the other, yielding
n = - (N - 4) / (1 - N) and
N = (4 + n) / (n - 1) .
No we can answer questions like, "For how many uses of 'print' is it worthwhile to abbreviate?" n = 5, so N = 9/4. Take the ceiling, since you can't effectively call print 1/4 times. So, 3. 3 uses. And indeed,
print print print
/P{print}p p p

(assuming you've already paid the overhead of <<>>begin to activate the definition, of course).
Of course, binary tokens makes this kind of moot, giving you the first 255 names from the system name table as 2-bytes: 0x92, 0x??. And binary tokens are also self-delimiting, requiring no whitespace before or after, since the high-bit of the first byte is outside of the ascii range.

Binary Tokens
For the ultimate zip-up of a PostScript program that final frontier is binary tokens which allows you to remove long operator names completely, at the cost of no longer having an ASCII-clean program.
So starting with a compacted block of postscript code
[/T[70{R 0 rlineto}48{}49{}43{A rotate}45{A neg rotate}91{currentdict
end[/.[currentpoint matrix currentmatrix]cvx>>begin begin}93{. setmatrix
moveto currentdict end end begin}>>/S{dup B eq{T begin exch{load exec}forall
end}{exch{load exch 1 add S}forall}ifelse 1 sub }>>begin moveto 0 S stroke

We look up all the names in the back of the PLRM (Appendix F, pp. 795-797)
appearance
in
vim    dec  meaning

<92>   146  'executable system name' binary token prefix
^A     1    add
^M     13   begin
^^     30   currentdict
'      39   currentmatrix
(      40   currentpoint
2      50   cvx
8      56   dup
9      57   end
=      61   eq  !)
>      62   exch
?      63   exec
I      73   forall
U      85   ifelse
d      100  load
h      104  matrix
k      107  moveto
n      110  neg
<85>   133  rlineto
<88>   136  rotate
§      167 stroke
©      169 sub

And then type them in prefixed by a 146 (decimal) byte. vim help for entering arbitrary bytes
Then in vim, the condensed file can be typed directly, so:

[/T[70{R 0^V146^V133}48{}49{}43{A^V146^V136}
  45{A^V146^V110^V146^V136}
  91{^V146^V30^V146^V57
  [/.[^V146^V40^V146^V104
  ^V146^V39]^V146^V50>>
  ^V146^V13^V146^V13}93{.
  ^V146^V156
  ^V146^V107^V146^V30
  ^V146^V57^V146^V57
  ^V146^V13}>>/S{^V146^V56
  B^V146^V61{T^V146^V13
  ^V146^V62{^V146^V100
  ^V146^V63}^V146^V73
  ^V146^V57}{^V146^V62{
  ^V146^V100^V146^V62

... you have to enter a space here to terminate the ^V-62 and start the 1, but you can back up and delete it later ...

1^V146^V1S}^V146^V73}
  ^V146^V85

... have to enter a space here to terminate the ^V-85 and start the 1, but you can back up and delete it later ...

1^V146^V169}>>^V146^V13
  ^V146^V107

... 3rd digit of 3-digit code terminates the byte-entry so the following 0 here is normal, conveniently ...

0 S^V146^V167

Which will look like this on screen (in vim):
[/T[70{R 0<92><85>}48{}49{}43{A<92><88>}45{A<92>n<92><88>}
91{<92>^^<92>9[/.[<92>(<92>h<92>']<92>2>>
<92>^M<92>^M}93{.<92><9c><92>k<92>^^<92>9<92>9<92>^M}
>>/S{<92>8B<92>={T<92>^M<92>>{<92>d<92>?}<92>I<92>9}{<92>>
{<92>d<92>>1<92>^AS}<92>I}<92>U1<92>©}>><92>^M
<92>k0 S<92>§

This one can often be omitted entirely if the aim is just to show a picture. Ghostscript paints most things to the screen without needing showpage.
¡    161   showpage

[This actually isn't working. Ghostscript's giving me undefined and syntaxerror for these tokens. Maybe there's some mode I need to enable.]

Maybe it's something about this program. The online compactor doesn't like it, either.

I suspect UTF-8 encoding is what killed you here. vim really wants to use UTF-8 for the file which means you get (more or less) 0xc2 (194) before top-bit-set characters. I've just tried your instruction after typing vim filename, on screen it looks like you say it should but the file has 194s in it. If you're on Linux, try using od -t u1 -c to check the file contents. Even vim -b/:set binary wasn't enough, I had to do LANG=C vim -b or vim -b then :set encoding=latin1. Personally, I've been using Emacs hexl-mode.

Change negative rolls to positive
Negative rolls can always be changed to positive rolls.
3 -1 roll
3 2 roll

5 -2 roll
5 3 roll

Which is more efficient 3 -1 roll or 3 2 roll? In my mental model, the former should be more efficient because it just takes one move. Is my mental model correct?

Honestly, I'm not sure. Here's my implementation, where all negative rolls are converted to positive as the first step. I think it would still require at least 2 moves (move 3rd value up, move 3 values down) with a flat-array implementation of the stack. But my stack is segmented so access goes through function calls to manage the segments; so there are certainly more efficient ways to implement than I have done. ... One thing I see now: I should check for stackunderflow outside of the loops.

The source file has moved since my last comment. Here's my implementation of the roll operator.

Use my G library
https://github.com/luser-dr00g/G
It's a text file. No extension, for the shortest possible syntax to load it.
It permits this 203-char Sierpinksi Triangle program
[48(0-1+0+1-0)49(11)43(+)45(-)/s{dup
0 eq{exch{[48{1 0 rlineto}49 1 index
43{240 rotate}45{120 rotate}>>exch
get exec}forall}{exch{load
exch 1 sub s}forall}ifelse 1 add}>>begin
9 9 moveto(0-1-1)9 s fill

to be rewritten in 151 bytes as
3(G)run $
{A - B + A + B - A}
{B B}

{A - B - B}7{[ex{du w{(>K?\2u)$}if}fora]}rep
cvx[/A{3 0 rl}/B 1 in/-{120 rot}/+{-120 rot}>>b
100 200(k?B9)$ showp

workfile with comments
Using the abbreviated system names feature, 1(G)run completely removes the burden of long operator names. An operator name need only be long enough to distinguish it from the others.
So

add becomes ad
mul becomes mu
index becomes i
etc, etc.

Use the PLRM Appendix F for the standard table of operator names.
And the feature of Operator Strings is available even if the abbreviated names is not selected. The bare library has a "base-level" selected by adding simply (G)run with no further decorations.
The base level includes a new function . which accepts the integer code for an operator (the same Appendix F mentioned above) and executes it.
The new function $ iterates through a string and calls . upon each one. So the ascii code directly selects the operator by number.
A new function @ lets you reach down to the bottom of the table in Appendix F by treating the space character (Ascii 0x20) as 0.
A new function # lets you reach further up into the table by first adding 95 (0x5F) so the space char 0x20 is treated as 127 (0x7F), the very next code after the last printable ascii character ~ 126 (0x7E).
Two new functions ! lets you access a deeply nested structure of arrays and/or dicts with an index array of indices/keys, rather than tedious expressions of many get (and put) operators.
(G)run 7 chars buys the base-level.
1(G)run 8 chars buys that AND abbreviated system names.
3(G)run $ 9 chars immediately begins an implicit-procedure block scanning sources lines until the next blank line, and defining the first line as a procedure called A, the next line is defined as a procedure called B, etc. This should remove most of the defs needed for defining lots of stuff, without needing to wrap them in a dictionary, nor even explicitly giving them names.

Error handling with stopped
For example, suppose f takes an argument from the stack and you want to apply f until the stack is empty.
{f}loop
will give a stack underflow when the stack becomes empty. So you could use
{count 0 gt{f}if}loop
but a shorter solution is:
{{f}loop}stopped
(Note that this leaves true on the stack.)

Hex colors in a string
(AZm){255 div}forall setrgbcolor selects the HTML color #415a6b, because A is hex 41, etc, so  (AZm) is the same as <415a6b>.
So if you have a bunch of different colors to use, you can put them on the stack ready to apply setrgbcolor for only 3 extra bytes per color. For example, this puts 5 colors #616263, #646566, ..., #6d6e6f (as 15 numbers between 0 and 1) on the stack:
(abcdefghijklmno){255 div}forall
In general you might have to use unprintable characters in the string.


text:
Compress data with context free grammars
It is possible to compress some kinds of data, such as human text or source code, with straight-line grammars. You basically create a grammar whose language has exactly one word – the uncompressed data. In this task, you have to write a program that implements this method of data compession.
Input
The input is a string of not more than 65535 bytes length. It is guaranteed, that the input matches the regular expression [!-~]+ (i.e. at least one printable ASCII character excluding whitespace).
An example input is

abcabcbcbcabcacacabcabab

Output
The output is a set of rules that form a grammar that describes exactly one word (the input). Each nonterminal is denoted by a decimal number greater than 9. The start symbol is symbol number ten. An example output corresponding to the example input is given below; its syntax is described further below:
10=11 11 12 12 11 13 13 11 14 14
11=a 12
12=b c
13=a c
14=a b

Each rule has the form <nonterminal>=<symbol> <symbol> ... with an arbitrary whitespace-separated number of symbols on the right side. Each output that obeys the following restrictions and derives exactly the input string is valid.
Restrictions
In order to stop people from doing strange things, a number of restrictions are taking place:

Each nonterminal must appear at least twice on the right side of a rule. For instance, the following grammar for the input abcabc is illegal because rule 12 appears only once:
  10=12
  11=a b c
  12=11 11

No sequence of two adjacent symbols may appear more than once in all right-hand sides of all rules, except if they overlap. For instance, the following grammar for the input abcabcbc is illegal since the sequence bc appears twice:
  10=11 11 b c
  11=a b c

A valid grammar would be:
  10=11 11 12
  11=a 12
  12=b c

Your program must terminate in less than one minute for each valid input that is not longer than 65535 bytes.

As usual, you may not use any facility of your language or any library function that makes the solution trivial or implements a large part of it.

Sample input
Generate sample input with the following C program.
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char **argv) {
  unsigned int i,j = 0,k;

  if (argc != 3
     || 2 != sscanf(argv[1],"%u",&i)
      + sscanf(argv[2],"%u",&k)) {
    fprintf(stderr,"Usage: %s seed length\n",argv[0]);
    return EXIT_FAILURE;
  }

  srand(i);

  while(j < k) {
    i = rand() & 0x7f;
    if (i > 34 && i != 127) j++, putchar(i);
  }

  return EXIT_SUCCESS;
}

The sample input generated by the program above will usually not result in good compression results. Consider using human text or source code as example input.
Winning criteria
This is code golf; the program with the shortest source code wins. For extra credit, write a program that reconstructs the input from the output.

Ha ha. I already have a few versions of this implemented (but not golfed) in Java for the [tag:kolmogorov-complexity] questions...

@PeterTaylor Which questions exactly?

It doesn't necessarily find a short enough answer to be worth posting (I'm adding grammar generating strategies and grammar engines slowly), but the core script in that project tries them out on http://codegolf.stackexchange.com/questions/1682 , http://codegolf.stackexchange.com/questions/6043 , http://codegolf.stackexchange.com/questions/4191 , http://codegolf.stackexchange.com/questions/4356 and a few components of other questions.

GolfScript, 111 108 characters
1/{.}{:^1<{^1$/,2>.{;,)^<.0?)!}*}do-1<.,1>{^1$/[10):10]*0+\+}{;^}if(\}while][0]%.,,]zip{))9+`"="+\~" "*+}%n*

This is a quite clumsy approach using GolfScript. The second version performs much better than the initial one. It is much longer than the intended code but my implementation had nested do-loops and this caused issues with the interpreter.
Examples:
> abcba
10=a b c b a

> abcabcbc
10=11 11 12
11=a 12
12=b c

> abcabcbcbcabcacacabcabab
10=11 12 12 13 14 14 c 11 15
11=15 13
12=c b
13=14 b
14=c a
15=a b

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Hello World in 1024 characters
In exactly 1024 characters, no more, no less:

Must print Hello World.
Must not use unnecessary whitespace.
Must not use comments.

Judging should favor creativity and/or humor over simple obfuscation when voting up answers.

The earliest I will select an answer is the 11th (Sunday) of November (2012). I'm seeing some awesome entries so far, can't wait to see what else people come up with.

What about unnecessary comments?

@Strigoides I say no unnecessary comments either. That's a pretty lame method for what I'm trying to inspire people to do.

Welcome to CodeGolf.SE! Code-bowling is usually about getting the largest character count, but you've set a target of 1024, which more than one answer has already hit. Given that, what's the objective winning criterion?

@Gareth Well, code-golf is about the shortest, so I wasn't sure what to tag this with. Have any suggestions? I figured that after a significant amount of time, the winner would either be the highest up-votes, or if no clear leader was to be found there, I'd pick the one I thought was most creative.

The problem with 'highest upvotes' or 'most creative' as winning criteria is that no-one really knows what will garner up-votes or what you personally will find creative. Unfortunately, I can't think of an objective winning criteria other than 'first to post' which would discourage further answers. As to the tag - I suppose if we're aiming to get as close as possible to a fixed target we could have [code-boules] or [code-curling] :-)

As soon as I get another 20 Rep points here, I'll change it to code-curling. I like that!

just like curling, i don't see the purpose of this. what is the winning criteria?

@ardnew while I don't personally like curling, its just like any other sport. The purpose is to have fun, and for those competing to win. There are rules posted, so the winning criteria would be the person with the most upvotes that actually followed the rules.

Quothe the FAQ: "All questions on this site, whether a programming puzzle or a code golf, should have [an] objective primary winning criterion, so that it is possible to indisputably decide which entry should win." Creativity and humor are not "objective". There seems to a lot of desire to have non-objective contests here, but this should be taken up on meta. Closing for now.

This type of question has come up before, and the moderators will close it if it breaks any rules no matter what, unfortunately. See http://codegolf.stackexchange.com/questions/6707/print-a-line-10-times-in-the-most-creative-way-possible

While I will read comments here and flag messages, I was really hoping that someone would take this up on meta. One user (luser droog) has opened a (related, I guess) topic as "Isn't there some way to have "just-for-fun" questions?", and that is certainly a good place to bring idea. Meta would also be the place to argue for changing the FAQ.

I have also added Should we consider dropping or modifying the "objective winning criteria" requirement?. Go to town.

The answers on this question have a ridiculous number of upvotes.  I say we reopen.  I suggested code-shuffleboard on meta quite a while ago, and this gives a good example of the creativity that can go into solutions for that type of challenge.

C# (and without “Hello World” anywhere)
Code-golfed, so that obviously no unnecessary whitespace is used:
using System;using System.IO.Compression;using System.Runtime.Serialization;using System.Runtime.Serialization.Json;using System.Linq;using System.Net;using System.Text.RegularExpressions;class C{static void Main(){var g=WebRequest.Create("https://api.stackexchange.com/2.1/questions/8859?site=codegolf&filter=withbody");var r=(HttpWebResponse)g.GetResponse();if(r.StatusCode==HttpStatusCode.OK){var s=r.GetResponseStream();foreach(var a in r.ContentEncoding.ToLowerInvariant().Split(',').Reverse())switch(a){case"gzip":s=new GZipStream(s,CompressionMode.Decompress);break;case"deflate":s=new DeflateStream(s,CompressionMode.Decompress);break;default:throw new InvalidOperationException();}var d=new DataContractJsonSerializer(typeof(R));var q=(R)d.ReadObject(s);var e=new Regex("([^<]*)");var m=e.Match(q.I[0].B);Console.WriteLine(m.Groups[1].Value);}}}[DataContract]public class R{[DataMember(Name="items")]public I[]I{get;set;}}[DataContract]public class I{[DataMember(Name="body")]public string B{get;set;}}

Formatted for readability:
using System;
using System.IO.Compression;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
using System.Linq;
using System.Net;
using System.Text.RegularExpressions;

class C
{
    static void Main()
    {
        var g = WebRequest.Create("https://api.stackexchange.com/2.1/questions/8859?site=codegolf&filter=withbody");
        var r = (HttpWebResponse)g.GetResponse();
        if (r.StatusCode == HttpStatusCode.OK)
        {
            var s=r.GetResponseStream();
            foreach (var a in r.ContentEncoding.ToLowerInvariant().Split(',').Reverse())
            switch(a)
            {
                case "gzip":
                    s = new GZipStream(s,CompressionMode.Decompress);
                    break;
                case "deflate":
                    s = new DeflateStream(s,CompressionMode.Decompress);
                    break;
                default:
                    throw new InvalidOperationException();
            }
            var d = new DataContractJsonSerializer(typeof(R));
            var q = (R)d.ReadObject(s);
            var e = new Regex("([^<]*)");
            var m = e.Match(q.I[0].B);
            Console.WriteLine(m.Groups[1].Value);
        }
    }
}

[DataContract]
public class R
{
    [DataMember(Name="items")]
    public I[] I { get; set; }
}

[DataContract]
public class I
{
    [DataMember(Name="body")]
    public string B { get; set; }
}

The program retrieves this question from Code Golf using Stack Exchange API, finds the first piece of text formatted as code (which, in case of this question, is the “Hello World” text), and prints it out.

That's a pretty creative way to do it!

This is epic.  Very, very cool.

Just hope no one trolls the question to change the question's formatting....

created a profile on code-golf just so I could upvote this question. Epic

Same as Ryan - added code-golf just to upvote this. Well played.

I want to edit the question so bad now.

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

This is 1024 characters, excluding the whitespace I added to make a nice 64*16 block.
The strategy is as follows:

Fill the first few bytes with characters "Hello World", except each byte is 5 too small.  This is done in all but the last 16 characters.  The first byte is left blank in order to not have the pointer go out of bounds later.
Bring the pointer back to the start, adding 5 to each byte using [+++++<]
Go through the characters, print them and zero the byte using >[.[-]>]

This looks like some form of minimalist art, I like it!

Gah, ye beat me to it.

JavaScript (1024 bytes...)
No unnecessary whitespace? What about unnecessary semicolons that JavaScript doesn't need at all? Let's add those semicolons to make people like Crockford happy.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;console.log('Hello World');;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Yes, I'm aware that this is abuse of rules.

You could also use curly braces, like {{{{{console.log("Hello, World!")}}}}}

Shell :)
echo '
.@@@@......@@@@.@@@@@@@@@@@.@@.........@@...........@@@@@@@@..
..@@@......@@@..@@.......@@..@..........@..........@........@@.
..@@@......@@@..@............@..........@.........@..........@@
..@@@@@@@@@@@@..@@@@@@.......@..........@.........@..........@@
..@@@@@@@@@@@@..@@@@@@.......@..........@.........@..........@@
..@@@......@@@..@............@..........@.........@..........@@
..@@@......@@@..@@.......@@..@@@@@@@@@@.@@@@@@@@@..@.......@@@.
.@@@@......@@@@.@@@@@@@@@@@..@@@@@@@@@@.@@@@@@@@@...@@@@@@@@..
@@............@@@..@@@@@.....@@@@@@@.....@@........@@@@@@@@@@.
.@@..........@@...@.....@.....@.....@@...@@.........@@.......@.
..@@........@@...@.......@....@.....@@...@@.........@@........@
...@@..@@..@@...@.........@...@@@@@@.....@@.........@@........@
....@@@.@@.@....@........@@...@@@@.@@....@@.........@@........@
....@@...@@@....@.......@@....@.....@@...@@.........@@.......@
...@@......@@....@.....@@.....@......@@..@@@....@@..@@@@...@@.
..@@.......@@@....@@@@@@....@@.......@..@@@@@@@@...@@@@@@@@@'

The 'W' is a little messed up.

Mathematica 1024 chars
Graph[Partition[
 Riffle[Characters[
 StringTake[ElementData[][[2]], 3] <>
  StringTake[WordData["high", "Antonyms"][[2, 2, 1]], 2] <>
  FromCharacterCode[Power[2, 5]] <>
  StringTake[GraphData[][[Prime@705]], 2] <>
  StringTake[AstronomicalData["Planet"][[1]], {3}] <> "ld"],
Rest@Characters[
  StringTake[ElementData[][[2]], 3] <>
   StringTake[WordData["high", "Antonyms"][[2, 2, 1]], 2] <>
   FromCharacterCode[Power[2, 5]] <>
   StringTake[GraphData[][[Prime[705]]], 2] <>
   StringTake[AstronomicalData["Planet"][[1]], {3}] <> "ld"]],
   2] /. {a_, b_} :> DirectedEdge[a, b],

EdgeLabelStyle -> Power[2, 4],
EdgeLabels -> (Partition[
   Riffle[l =
     Characters[
      StringTake[ElementData[][[2]], 3] <>
       StringTake[WordData["high", "Antonyms"][[2, 2, 1]],
        1 + 1] <> FromCharacterCode[Sqrt[Sqrt[1048576]]] <>
       StringTake[GraphData[][[Prime[705]]], 2] <>
       StringTake[AstronomicalData["Planet"][[1]], {3}] <> "ld"],
    Rest@l], 2] /. {a_, b_} :> DirectedEdge[a, b]) +
Power[{1, 8, 27, 64, 125, 216, 343, 512, 729, 1000},
 1/3] /. {Plus[a_, b_] :> Rule[b, a]},
VertexLabelStyle -> Directive[RGBColor[0, 0, 1], Large],
VertexLabels -> "Name", ImagePadding -> Power[5, 2],
ImageSize -> 2^2*5^2*7]

De-bowled (partially)
For those who don't have access to Mathematica's curated data:
 ElementData[][[2]]
 WordData["high", "Antonyms"][[2, 2, 1]]
 GraphData[][[Prime[705]]]
 AstronomicalData["Planet"][[1]]

"Helium"
"low"
"WongGraph"
"Mercury"

"Hel" (from "Helium") + "lo" (from "low") + " " (FromCharacterCode[32]) + "Wo" (from "WongGraph") + "r" (from "Mercury") + "ld"
yields the string "Hello World".
The string is split into characters, each of which becomes a vertex in the following graph:
Graph[{"H" \[DirectedEdge] "e", "e" \[DirectedEdge] "l",
 "l" \[DirectedEdge] "l", "l" \[DirectedEdge] "o",
 "o" \[DirectedEdge] " ", " " \[DirectedEdge] "W",
 "W" \[DirectedEdge] "o", "o" \[DirectedEdge] "r",
 "r" \[DirectedEdge] "l", "l" \[DirectedEdge] "d"},

EdgeLabelStyle -> 16,
EdgeLabels -> {"H" \[DirectedEdge] "e" -> 1, "e" \[DirectedEdge] "l" -> 2, "l" \ [DirectedEdge] "l" -> 3,
"l" \[DirectedEdge] "o" -> 4, "o" \[DirectedEdge] " " -> 5,
" " \[DirectedEdge] "W" -> 6, "W" \[DirectedEdge] "o" -> 7,
"o" \[DirectedEdge] "r" -> 8, "r" \[DirectedEdge] "l" -> 9,
"l" \[DirectedEdge] "d" -> 10},
VertexLabelStyle -> Directive[Blue, Large], VertexLabels -> "Name", ImagePadding -> 25]

Wow... that's awesome.

C, 1024 characters
Here's an adaptation of my answer to another "Hello, world" question:
I'm not sure what's "unnecessary whitespace". I used spaces, indentation and line breaks to make code nicely formatted, but strictly speaking most of it is unnecessary. I did count the whitespace in the 1024 chars.
EDIT: Changed to return! in the first line. Nicer this way, I think.
#include <stdio.h>
int main(int argc, char **argv, char **envp) {
        return!
        putchar(-~-~-~-~-~-~-~-~-~-~!
        putchar(~-~-~-~-~-~-~-~-
        putchar(~-~-~-~-~-~-
        putchar(-~-~-~
        putchar(-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
        putchar(-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
                ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
        putchar(-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
                ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
                -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
                ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
                -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
                ~-~
        putchar(-~-~-~
        putchar(
        putchar(-~-~-~-~-~-~-~
        putchar(-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
        putchar(-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
                ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
                -~-~-~0))))))))))));
}

Another one - Python this time
1024 characters, 944 of them are whitespace, all necessary.
print 11*'%c'%tuple(len(x)+8for x in'                                                                /                                                                                /                                                                                /                                                                                /                                                                                /                        /                                                                               /                                                                                /                                                                                /                                                                                /                                                                                '.split('/'))

lmao: "fatal error C1026: parser stack overflow, program too complex"

@AK4749, works in ideone.com.

damn visual studio lol

GolfScript
I had to modify the max length of scripts on http://golfscript.apphb.com/ for this :)
1)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
))))))))1)))))))))))))))))))))))))))))))))))))))))))))))))))))))
)))))))))))))))))))))))))))))))))))))))))))))1))))))))))))))))))
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
)))))))))))))))))))))))))1))))))))))))))))))))))))))))))))))))))
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
)))))1))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
))))))))))))))))))))))))))))))))))))))))))))))))))))' '1))))))))
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
))))))))))))))1)))))))))))))))))))))))))))))))))))))))))))))))))
)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))1))
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
)))))))))))))))))))))))))))))))))))))))))))))))1))))))))))))))))
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
)))))))))))))))))))))))))))1))))))))))))))))))))))))))))))))))))
))))))))))))))))))))))))))))))))))))))))))))))))))))))){)}8*]''+

Run the program online here.

+1 for modifying the max length of golfscript scripts for this...

Haskell
main=putStrLn hello_world
 where hello_world=show H++ello_world
        where ello_world=show E++llo_world
               where llo_world=show L++lo_world
                      where lo_world=show L++o_world
                             where o_world=show O++_world
                                    where _world=show ++world
                                           where world=show W++orld
                                                  where orld=show O++rld
                                                         where rld=show R++ld
                                                                where ld=show L++d
                                                                       where d=show D
data Letter=H|E|L|O||W|R|D
instance Show Letter where
 show H=["Hello, World!"!!0]
 show E=["Hello, World!"!!1]
 show L=["Hello, World!"!!2]
 show O=["Hello, World!"!!4]
 show =["Hello, World!"!!6]
 show W=["Hello, World!"!!7]
 show R=["Hello, World!"!!9]
 show D=["Hello, World!"!!11]
main::IO()

1024 characters, including the (necessary, Haskell is indentation-sensitive!) whitespace. (Though you could remove the line breaks entirely, but who wants an unreadable one-liner? Even now, it's hard enough to guess what this program does, what with the lack of comments...)

Python 2 - 1024
print''.join(chr(32if c[0]>"z"else """
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita
kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem
ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd
gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum
dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero
eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no
sea takimata sanctus est Lorem ipsum dolor sit amet. Duis autem vel enum...
""".count(c[0]+c[1])+99)for c in zip(' yddd~ doda','t iio~doliu')).title()

Writing this program was quite a tedious process, the length of the algorithm (first and last line) impacts the length of the dummy text (to meet the required total number of 1024 characters), which in turn impacts the count of certain substrings... And even worse: Some counts might just not occur with any substring, so I need to adjust the general bias 99, which impacts all other letters. But happily, a helper script is always quickly implemented. :)

Wow. Never thought lorem ipsum would result in hello world.

Javascript, cut and paste into console (chrome browser of course) on this page to see the page disappear!
function pad_with_zeroes(number, length){
var my_string = '' + number;
while (my_string.length < length){
my_string = '0' + my_string;
}
return my_string;
}
var code_tags = document.getElementsByTagName('code');
var hello_world = code_tags[0].innerHTML;
var body_tags = document.getElementsByTagName('body');
var body = 'NULL';
body = body_tags[0];
var html_input = "
" +hello_world+ "
";
body.innerHTML = html_input;
var span = document.getElementById('hello_world_span');
var div = document.getElementById('div_that_holds_hello_world');
var j_c = 1;
var i_c = 0;
var setIn = setInterval(function(){
i_c++;
if(i_c%2 == 0){
span.style.display = 'none';
}else{
span.style.display = 'block';
}
if(i_c%50 != 0){
div.style.fontSize = j_c + 'px';
if(i_c < 1000000){
div.style.color = '#'+ pad_with_zeroes(i_c, 6);
}else{
i_c = 0;
}
j_c++;
}else{
j_c = 0;
}
}, 500);

@JoeTuskan part of that is javascript, like when I create the html for html_input. And part was just cause I was trying to do this very quickly :)

@JoeTuskan there fixed them all (I think) they were not in there to get me on the char count.

comment removed. I'd upvote again if possible :)

Javascript
Lipsum Test with a regex:
"Hello World|Ta what. Soft lad mardy bum that's champion. Tha knows chuffin' nora tha knows tha knows mardy bum shurrup. Where's tha bin. Any rooad ne'ermind. Is that thine cack-handed ah'll gi' thee a thick ear. Ah'll gi' thee a thick ear. Gerritetten tintintin ah'll learn thi shurrup chuffin' nora. Sup wi' 'im. Nah then soft southern pansy tintintin breadcake t'foot o' our stairs how much. Shu' thi gob be reet th'art nesh thee ah'll gi' thee a thick ear that's champion. Shu' thi gob t'foot o' our stairs tha daft apeth where's tha bin ah'll gi' thi summat to rooer abaht. Wacken thi sen up eeh eeh. Shu' thi gob tha what that's champion soft southern pansy ah'll learn thi a pint 'o mild. Appens as maybe gi' o'er nobbut a lad nobbut a lad.Big girl's blouse a pint 'o mild. Big girl's blouse ah'll learn thi. A pint 'o mild. How much ah'll gi' thi summat to rooer abaht michael palin nay lad. Gerritetten a pint 'o mild be reet nay lad. Nay lad how much ee by gum. 1234567I love feet so much.".match(/Hello World/)[0]

The regex: .match(/Hello World/)[0]

Lots of unnecessary whitespace.

@ugoren, would you prefer underscores?

Nice! You could  also replace the regex match by a .slice(-N)

Python
Kinda cheap:
print"""Hello World"""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""+""

Could have livened it up a bit with adding some arbitrary strings, and the substringing them off

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Output a shuffled deck using random input
Input/Output:
Input: A uniformly random, infinitely long, string of '0's and '1's, taken from stdin.  The string is assumed to be truly random, not pseudo-random.  It is uniform in that each character is equally likely to be a '0' or '1'.
Careful! The input is infinitely long, so you can't store it all in memory using a function like raw_input() in python.  If I'm not mistaken, golfscript will fail with infinite input, since it pushes the entire input onto the stack prior to running.
Output: A uniformly random shuffled standard deck, without jokers.  It is uniform in that all orderings are equally likely.
Each card in the output is it's rank, A, 2-9, T, J, Q or K concatenated with it's suit, c, d, h or s.  For example, the 10 of spades is Ts
The cards of the deck should be separated by spaces.
You may not use built-in random libraries or functions because they are not truly random, only pseudo-random.
Example input
You may use the following python script to pipe input into your program:
import sys, random
try:
    while True:
        sys.stdout.write(str(random.randint(0,1)))
except IOError:
    pass

If you save the script as rand.py, test your program with python rand.py | your_program
In python 3 it runs as expected, but in python 2.7 I get an error message after my program's output, but only after everything's done, so just ignore the error message.
Example output:
Here's how the deck should be printed if it happened to be shuffled into a sorted order:
Ac 2c 3c 4c 5c 6c 7c 8c 9c Tc Jc Qc Kc Ad 2d 3d 4d 5d 6d 7d 8d 9d Td Jd Qd Kd Ah 2h 3h 4h 5h 6h 7h 8h 9h Th Jh Qh Kh As 2s 3s 4s 5s 6s 7s 8s 9s Ts Js Qs Ks

Scoring:
This is a code golf.  Shortest code wins.
Example program:
Here is a python 2.7 solution, not golfed.
import sys
def next():
    return int(sys.stdin.read(1))==1
def roll(n):
    if n==1:
        return 0
    if n%2==0:
        r=roll(n/2)
        if next():
            r+=n/2
        return r
    else:
        r=n
        while(r==n):
            r=roll(n+1)
        return r
deck = [rank+suit for suit in 'cdhs' for rank in 'A23456789TJQK']
while len(deck)>0:
    print deck.pop(roll(len(deck))),

"If I'm not mistaken, golfscript will fail with infinite input, since it pushes the entire input onto the stack prior to running." Well, that's one way to take it out of the running.

I'm a little bit confused, forgive me. What does the input have to do with the actual deck shuffling? Perhaps I just need a little clarification.

You can't use pseudo-random functions in your code, so you need to use the input (which we're assuming is truly random) to generate randomness.
For example, in python you can use (sys.stdin.read(1)=='1') to get a random boolean, but you can't use (random.randint(0,1)==1), because it's only pseudo-random.

Ruby, 89 87 characters
l=*0..51;l.map{l-=[i=l[gets(6).to_i 2]||redo];$><<'A23456789TJQK'[i/4]+'cdhs'[i%4]+' '}

Edit: previous version
l=*0..51;(l-=[i=l[gets(6).to_i 2]];i&&$><<'A23456789TJQK'[i/4]+'cdhs'[i%4]+' ')while l[0]

Perl, 80 chars
here is another implementation that does not suffer from the bias and is two characters shorter:
$/=1x9;$_=A23456789TJQK;s/./$&s$&c$&d$&h/g;%h=map{<>.$_,"$_ "}/../g;say values%h

old implementation (82 chars):
$/=1x9;$_=A23456789TJQK;s/./$&s$&c$&d$&h/g;say map/..$/&&$&.$",sort map<>.$_,/../g

old implementation description:
# set input record separator (how internal readline() delimits lines) to "11111111"
$/ = 1x9;

# constructs a string representation of all 52 cards: "AsAc(...)KdKh"
$_ = A23456789TJQK; s/./$&s$&c$&d$&h/g;

# for each pair of characters (each card) in the string $_
foreach $card (/../g)
{
    # read from STDIN until $/ is found (this may NEVER occur!), which
    # results in a random string of 1s and 0s
    $weight = <>;

    # append the card identifier onto the random string
    $card = $weight . $card;

    # add this new card identifier to a new list
    push @cards, $card;
}

# sort the cards with their random string prefix
sort @cards;

# for each card in the "randomly sorted" list
foreach $card (@cards)
{
    # capture the final two characters from the card (the rank and suit),
    # and append a space onto them
    $card =~ /..$/;
    $card = $card . $";

    print $card;
}

Just curious: can anybody show that this approach produces each deck of cards with same probability?

If I'm reading this right (IANAPH), it assigns random 'weights' to each card, and then sorts by weight.   When two cards are assigned the same weight, they'll be left in order by sort, resulting in a bias towards alphabetic ordering.

you are right, @boothby. the sort does leave this solution with a bias in the case that multiple cards have the same "weight". it also can't be guaranteed that this solution will ever produce a result. I'll add a description of how it works so that someone smarter than me can analyze it

It's perfectly fine if some inputs cause the program to never terminate, as long as the probability that the program terminates approaches 1 as time approaches infinity.  The example program never terminates on an input of all '1's.  I'm pretty sure it's actually impossible to get uniform randomness while knowing your program terminates after a certain number of bits read.

@cardboard_box Actually, yes, it's possible.  http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle

@cardboard_box, there's another very simple method.  Pick a random number n between 1 and factorial(52).  Enumerate deck orderings, and return the n-th one.

How can you pick a uniformly random number between 1 and 3 with a finite number of bits?  You'll need to do that near the end of the Fisher-Yates shuffle, and factorial(52) is divisible by 3 so it shares the same problem.

Ah, fair enough.

C, 197 178 161 chars
EDIT: Using a new random function, which is much shorter - reads a 4-digit integer s and uses s%64. Each 6-digit decimal number made of 0 and 1 only, taken %64 results in a unique result, so the randomness is good.
This approach consumes much more random bits, but is significantly shorter.
B[52],t,s,i=104;
r(){scanf("%6d",&s);s%=64;s>i&&r();}
main(){
    for(;i--;)B[i%52]=i<52
        ?r(),t=B[s],B[s]=B[i],printf("%c%c\n","23456789ATJQK"[t/4],"cdhs"[t%4]),t
        :i-52;
}

The basic logic is simple - initialize an array of 52 ints with 0..51, shuffle (randomally replace element x with another from the range 0..x), print formatted (n/4=rank, n%4=suit).
One loop, that runs 104 times, does initialization (first 52 runs), shuffling and printing (last 52 runs).
A random number is generated by pulling n random bits, until 1<<n is at least the desired maximum. If the result is more than the maximum - retry.

This complicated s>7?"ATJQK"[s-8]:s+50 is longer than the simple "A23456789TJQK"[s]. Second you can use t/4 and t%4 instead of t%13 and t/13.

Don't need to still put t back into the array when outputting

Python 122
import sys
D=[R+S for S in'cdhs'for R in'A23456789TJQK']
while(D):
    x=int(sys.stdin.read(6),2)
    if x<len(D):print D.pop(x)

Explanation:
Unused cards are stored in D. This simply gets the next valid random index from the input stream and pops that element from D.
Unless I am missing something, there shouldn't be a bias. The script will throw out any invalid indices > len(D), but this doesn't result in a bias for lower numbers because each successive pop will reduce the index of each element past than i.

So you discard most of the (infinite) random input? I.e. you stop shuffling once you have no "unused" cards?

unix shell ~ 350
This is not short or pretty, nor is it efficient, however I was wondering how hard it would be to do this with standard unix shell utilities.
This answer chops up the infinite binary string into 6 bit lengths and only chooses those that are in the correct range (1-52), here the infinite binary string is simulated by urandom and xxd:
</dev/urandom xxd -b | cut -d' ' -f2-7 | tr -d ' \n'

The chopping and selection is done with fold, sed and bc:
random_source | {echo ibase=2; cat | fold -w6 | sed -r 's/^/if(/; s/([^\(]+)$/\1 <= 110100 \&\& \1 > 0) \1/'}

This produces lines such as:
if(101010 <= 110100 && 101010 > 0) 101010

Which can be directed into bc.
From this stream of numbers, the sequence of the deck is chosen like this (I'm using zsh, but most modern shells should be adaptable to this):
deck=({1..52})
seq_of_numbers | while read n; do
  if [[ -n $deck[n] ]]; then
    echo $n; deck[n]=""
    [[ $deck[*] =~ "^ *$" ]] && break
  fi
done

The randomized number sequence now needs to be changed into card names. The card name sequence is easily generated with GNU parallel:
parallel echo '{2}{1}' ::: c d s h ::: A {2..9} T J Q K

Combining the output from the last two commands with paste and sorting on the numbers:
paste random_deck card_names | sort -n | cut -f2 | tr '\n' ' '

The whole thing as one monstrous one-liner (only tested in zsh):
paste \
  <(deck=({1..52}); \
    </dev/urandom xxd -b | cut -d' ' -f2-7 | tr -d ' \n' |
      {echo ibase=2; fold -w6 | sed -r 's/^/if(/; s/([^\(]+)$/\1 <= 110100 \&\& \1 > 0) \1/'} |
      bc |
      while read n; do
        if [[ -n $deck[n] ]]; then
          echo $n; deck[n]=""
          [[ -z ${${deck[*]}%% *} ]] && break
        fi
      done) \
  <(parallel echo '{2}{1}' ::: c d s h ::: A {2..9} T J Q K) |
sort -n | cut -f2 | tr '\n' ' '

Edit - added bash version
Here is a version that works in bash. I removed the in-shell { } and array indexes are zero based. Array emptiness is checked with parameter expansion, slightly more efficient and also adopted in the example above.
paste \
  <(deck=($(seq 52)); \
    </dev/urandom xxd -b | cut -d' ' -f2-7 | tr -d ' \n' |
      (echo ibase=2; fold -w6 | sed -r 's/^/if(/; s/([^\(]+)$/\1 <= 110100 \&\& \1 > 0) \1/') |
        bc |
        while read n; do
          if [[ -n ${deck[n-1]} ]]; then
            echo $n
            deck[n-1]=""
            [[ -z ${deck[*]%% *} ]] && break
          fi
        done \
  ) \
  <(parallel echo '{2}{1}' ::: c d s h ::: A {2..9} T J Q K) |
sort -n | cut -f2 | tr '\n' ' '; echo

K&R c -- 275

v3 Index into the string literals directly
v2 Suggestion from luser droog in the comments to use strings and replaced remaining char literals with int literals

Golfed:
#define F for(i=52;--i;)
#define P putchar
M=1<<9-1,i,j,k,t,v,s,a[52];r(){t=0,j=9;while(--j)t=t<<1|(getchar()==49);
return t;}main(){F a[i]=i;F{k=i+1;do{j=r();}while(j>M/k*k-1);j%=i;t=a[i];
a[i]=a[j];a[j]=t;}F{s=a[i]&3;v=a[i]>>2;P(v>7?"TJQKA"[v-8]:v+50);
P("cdhs"[s]);P(32);}}

Pretty much brute force here. I just read nine bits from the input to form a minimal RNG output, and make the usual redraw-if-the-unused-values-at-the-end modulus reduction to get uniform output to power a selection shuffle.
This un-golfed version differs in that it takes the input from /dev/urandom rather than from the described input format.
#include <stdio.h>
M=1<<8-1, /* RANDMAX */
  i, j, k, /* counters */
  t, /* temporary for swapping, and accumulating */
  a[52]; /* the deck */
r(){ /* limited, low precision rand() that depends on a random stream
    of '0' and '1' from stdin */
  t=0,j=9;
  while(--j)t=t<<1|(getchar()&1);
  return t;
}
main(){
  for(i=52;--i;)a[i]=i;  /* initialize the deck */
  for(i=52;--i;){
    /*  printf("shuffling %d...\n",i); */
    k=i+1;
    do { /* draw *unifromly* with a a-unifrom generator */
      j=r();
      /* printf("\t j=0x%o\n",j); */
    }while(j>M/k*k-1); /* discard values we can't mod into evently */
    j%=i;
    t=a[i];a[i]=a[j];a[j]=t; /* swap */
  }
  for(i=52;--i;){ /* output the deck */
    j=a[i]&3;
    k=a[i]>>2;
    putchar(k>7?"TJQKA"[k-8]:k+'2');
    putchar("cdhs"[j]);
    putchar(' ');
  }
}

+1 I have much to learn. BTW, why not "TJQKA" and "cdhs"?

Oh. Right. ints. I get it. Might still be worth it to save all the punctuation. Might even factor the char out of getchar and putchar with a crazy pasty macro...

Macro substitutions need to gain a lot because they have to start with #define N  and end with a newline that counts as a character and that's 11, plus the bit you are replacing. There are certainly a few more characters in replacing some or all of the character literals with int literals, but it's late here...maybe I'll do it another time.

@luserdroog Clearer headed now. Of course strings are better--though you have to specify the type--because characters are just short integers. Plus I can combine them and the ASCII substitutions get a bunch of strokes in one go.

PHP, 158 chars
Newlines have been added to stop the code block gaining scrollbars, they can safely be removed.
for($i=52,$x='shdcKQJT98765432A';$i--;$c[]=$x[4+$i%13].$x[$i/13]);
while(ord($i=fgetc(STDIN)))$c[$i]^=$c[$a]^=$c[$i]^=$c[$a=2+($a+++$i)%50];
die(join(' ',$c));

Before I get told to add a <?php, let it be known you can invoke PHP without this tag quite easily, using: cat golf.php | php -a
De-golfed and commented:
// Abuse of the for construct to save a bit of space, and to make things more obscure looking in general.
for (
    // Card suit and number are reversed because we're using a decrementor to count
    // down from 52, instead of up to 52
    $i = 52,
    $x = 'shdcKQJT98765432A';
    // Condition AND per-loop decrement
    $i--;
    // Add a new element to the array comprising of $i mod 13 + 4 (to skip suit ids)
    // followed by simply $i divided by 13 to pick a suit id.
    $c[] =
        $x[4 + $i % 13] .
        $x[$i / 13]
);

while(

    // Assignment inside the condition, a single character from input.
    ord($i = fgetc(STDIN))
)
    // In-place swap. Shorter than using a single letter temporary variable.
    // This is the pseudo-random shuffle.
    $c[$i] ^=
    $c[$a] ^=
    $c[$i] ^=
    $c[
        // We use the input (0 or 1) to identify one of two swap locations at the
        // start of the array. The input is also added to an accumulator (to make
        // the increments "random") that represents a swap destination.
        $a = 2 + ($a++ + $i) % 50
    ];

// Dramatic way of doing "echo" in the same space.
die(
    join(' ', $c)
);

There are two expected errors, that do not affect the output of the program.
The first is because $a is not initialised, but the NULL is converted to 0 and the program continues.
The second is because the character stream seems to get a newline from somewhere, even if it's not supplied (good ol' PHP), and that is an undefined index in the array. It's the last character of input, and does not affect output.


text:
Create a C program that takes the longest period of time to compile in gcc
Create a short C program that takes an absurdly long time to compile with gcc. Entries will be scored by timing the compilation then subtracting the reference program's compile time.
Rules

Any C language feature or gcc extension
gcc 4.2.1

Changed the tagging because [code-golf] explicitly means "shorted code by (key) stroke count".

Dividing by the number of characters doesn't make much sense, because any reasonable approach to this challenge will of course have a compile-time–complexity larger O ( n ), i.e. the score of any solution can be trivially increased by just making it a bit longer, which will probably always be possible in an obvious way.

#define a "xxxxxxxxxxx"
#define b a a a a a a a
#define c b b b b b b b
#define d c c c c c c c
#define e d d d d d d d
#define f e e e e e e e
#define g f f f f f f f
#define h g g g g g g g
#define i h h h h h h h
#define j i i i i i i i
z=j;

Does not compile on my machine

At a minimum the last line needs to be changed to something like main(){char*z=j;} to make this a valid c program.

My VS2012 gets out of heap space. I guess /Zm would fix it

Both Charlie's answer and my earlier one work on the principle of letting the pre-processor write a lot of code, but they mostly exercise the pre-processor itself, the lexer (good idea as this step has traditionally been slow) and the parser. Mine also attempts to work the optimization and code generation steps, but it is clearly not gaining a lot there.
Thinking about how a typical c compiler works, I realized that we weren't giving the symbol table related code anything to do. This entry is an attempt to remedy that. It is supposed to be reminiscent of basic object-orientation in c implementation, but doesn't do anything interesting: justuses the pre-processor expansion technique to declare and trivially (and incorrectly) initializes a bunch of objects. Object that use complicated types, on many levels of scope, shadowing each other at various removes. It ought to give the symbol table a real
work out.
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
// Exercise the symbol table mechanism of the compiler in an effort to
// take a unreasonable about of time compiling

#define PTR(T) T*
#define CONST(T) T const
#define FUNC(NAME,RTYPE,ARG) RTYPE NAME(ARG)
#define FPTR(NAME,RTYPE,ARG) FUNC((*NAME),RTYPE,ARG)

// Forward decalration of repeated OO method pointers
typedef void* (*cctor_ptr)(void*this, void*that, ...);
typedef void* (*dtor_ptr)(void*this);

// Assumes three var-args: sizeof(payload type), cctor, dtor
void* default_ctor(void*this, ...){
  // Pull in variadac bits
  va_list list;
  va_start(list,this);
  int size=va_arg(list,int);
  cctor_ptr cctor=va_arg(list,cctor_ptr);
  dtor_ptr dtor=va_arg(list,dtor_ptr);
  va_end(list);
  // process
  if (!this) this = malloc(size);
  if (this) {
    memset(this,size,0);
    /* various dodges to install the cctor and dtor in the write places */
  }
  return this;
}
// Copies the payload from that to this;
void* default_cctor(void*restrict this, void* restrict that, ...){
  // Pull in variadac bits
  va_list list;
  va_start(list,that);
  int size=va_arg(list,int);
  cctor_ptr cctor=va_arg(list,cctor_ptr);
  dtor_ptr dtor=va_arg(list,dtor_ptr);
  va_end(list);
  // process
  if (!this) this = malloc(size);
  if (this) {
    memcpy(this,that,size);
    /* various dodges to install the cctor and dtor in the write places */
  }
  return this;
}
// Assumes that his was allocated with malloc, does not use varargs
void* default_dtor(void*this, ...){
  free(this);
  return NULL;
};

#define DECLARE_STRUCT(N) struct S##N##_s
#define TYPEDEF_ACCESSOR(N,T) typedef FPTR(f##N##_ptr,CONST(PTR(T)),PTR(CONST(struct S##N##_s)))
#define TYPEDEF_STRUCT(N,T) typedef struct S##N##_s {PTR(T)p; cctor_ptr cctor; dtor_ptr dtor; f##N##_ptr f##N;} S##N
#define OO_STRUCT(N,T) DECLARE_STRUCT(N); TYPEDEF_ACCESSOR(N,T); TYPEDEF_STRUCT(N,T)

OO_STRUCT(1,char);
OO_STRUCT(2,int);
OO_STRUCT(3,double*);
OO_STRUCT(4,S3);
OO_STRUCT(5,S4);
OO_STRUCT(6,S5);
OO_STRUCT(7,S6);
OO_STRUCT(8,S7);

#define SUBSCOPE(A) { \
    S1*A##1=default_ctor(NULL,sizeof(char),default_cctor,default_dtor); \
    S2 A##2; default_ctor(&A##2,sizeof(int),default_cctor,default_dtor); \
    S2*A##3=default_ctor(NULL,sizeof(double*),default_cctor,default_dtor); \
    S8 A##5; default_ctor(&A##5,sizeof(S4),default_cctor,default_dtor); \
    S6 A##6; default_ctor(&A##6,sizeof(S5),default_cctor,default_dtor); \
    S8*A##8=default_ctor(NULL,sizeof(S7),default_cctor,default_dtor); \
  }
#define SUBSCOPE2(A,B)  { \
    S2*B##5=default_ctor(NULL,sizeof(S4),default_cctor,default_dtor); \
    S4 A##7; default_ctor(&A##7,sizeof(S6),default_cctor,default_dtor); \
    SUBSCOPE(A) SUBSCOPE(B);                 \
  }
#define SUBSCOPE6(A,B,C)  { \
    S2*A##3=default_ctor(NULL,sizeof(double*),default_cctor,default_dtor); \
    S2 B##2; default_ctor(&B##2,sizeof(int),default_cctor,default_dtor); \
    S4*C##4=NULL;                           \
    SUBSCOPE2(A,C) SUBSCOPE2(B,C) SUBSCOPE2(A,B); \
  }
#define SUBSCOPE24(A,B,C,D) { \
    S1*D##1=default_ctor(NULL,sizeof(char),default_cctor,default_dtor); \
    S2 C##2; default_ctor(&C##2,sizeof(int),default_cctor,default_dtor); \
    S2*B##3=default_ctor(NULL,sizeof(double*),default_cctor,default_dtor); \
    S4 A##4; default_ctor(&A##4,sizeof(S3),default_cctor,default_dtor); \
    SUBSCOPE6(A,B,C) SUBSCOPE6(A,B,D) SUBSCOPE6(A,C,D) SUBSCOPE6(B,C,D); \
  }
#define SUBSCOPE120(A,B,C,D,E) { \
    S5*A##5=default_ctor(NULL,sizeof(S4),default_cctor,default_dtor); \
    S6*A##6=default_ctor(NULL,sizeof(S5),default_cctor,default_dtor); \
    S8 A##8; default_ctor(&A##8,sizeof(S7),default_cctor,default_dtor); \
    SUBSCOPE24(A,B,C,D) SUBSCOPE24(A,B,C,E) SUBSCOPE24(A,B,D,E); \
    SUBSCOPE24(A,C,D,E) SUBSCOPE24(B,C,D,E); \
  }
#define SUBSCOPE720(A,B,C,D,E,F) { \
    S5 A##5; default_ctor(&A##5,sizeof(S4),default_cctor,default_dtor); \
    S6 A##6; default_ctor(&A##6,sizeof(S5),default_cctor,default_dtor); \
    S8*A##8=default_ctor(NULL,sizeof(S7),default_cctor,default_dtor); \
    SUBSCOPE120(A,B,C,D,E) SUBSCOPE120(A,B,C,D,F) SUBSCOPE120(A,B,C,E,F); \
    SUBSCOPE120(A,B,D,E,F) SUBSCOPE120(A,C,D,E,F) SUBSCOPE120(B,C,D,E,F); \
  }

int main(){
  S4 s4;
  SUBSCOPE720(A,B,C,D,E,F)
}

Compile time on my machine is in excess of 4 seconds with -O3 and more than 1 second with no optimization.

Obviously the next step would be to finish the OO implementation for a BCD classes and re-do the pi calculations using it so that I get both effects running hard.

Here's a riff of the exponential-preprocessor-expansion theme which does something minimally interesting: computes two approximations to pi by series methods and compares with both the value in math.h and the usual incantation.
Ungolfed.
#include <math.h>
#include <stdio.h>

// Some random bits we'll need
#define MINUSONODD(n) (n%2?-1:+1)
#define TWON(n) (2*(n))
#define NPLUSONE(n) ((n)+1)
#define TWONPLUSONE(n) NPLUSONE(TWON(n))
#define FACT(n) (tgamma(NPLUSONE(n)))

// The Euler series
//                           2^(2n) * (n!)^2      z^(2n+1)
// atan(z) = \sum_n=0^\infty --------------- * ---------------
//                               (2n+1)!       (1 + z^2)^(n+1)
#define TERMEULER(n,z) (pow(2,TWON(n))*                 \
            FACT(n)*FACT(n)*                \
            pow((z),TWONPLUSONE(n))/            \
            FACT(TWONPLUSONE(n)) /              \
            pow((1+z*z),NPLUSONE(n)) )

// The naive version
//                           (-1)^n * z^(2n+1)
// atan(z) = \sum_n=0^\infty -----------------
//                                2n + 1
#define TERMNAIVE(n,z) (MINUSONODD(n)*pow(z,TWONPLUSONE(n))/TWONPLUSONE(n))

// Define a set of bifruncations of the sum
#define N2TERMS(n,z,ALG)  (TERM##ALG(TWON(n),(z)) + TERM##ALG(TWONPLUSONE(n),(z)))
#define N4TERMS(n,z,ALG)  (N2TERMS(TWON(n),(z),ALG)+N2TERMS(TWONPLUSONE(n),(z),ALG))
#define N8TERMS(n,z,ALG)  (N4TERMS(TWON(n),(z),ALG)+N4TERMS(TWONPLUSONE(n),(z),ALG))
#define N16TERMS(n,z,ALG) (N8TERMS(TWON(n),(z),ALG)+N8TERMS(TWONPLUSONE(n),(z),ALG))
#define N32TERMS(n,z,ALG) (N16TERMS(TWON(n),(z),ALG)+N16TERMS(TWONPLUSONE(n),(z),ALG))

// Sum the fist 32*2+16 = 80 terms of a series...
#define PARTIALSUM(z,ALG) N32TERMS(0,(z),ALG)+N32TERMS(1,(z),ALG)+N16TERMS(4,(z),ALG)

int main(void){
  const double PI_TRAD = 4.0L * atan(1.0);
  const double PI_NAIVE = 4.0L * PARTIALSUM(0.999999L,NAIVE);
  const double PI_EULER = 4.0L * PARTIALSUM(0.999999L,EULER);
  printf("pi (math.h) = %10.8f\n",M_PI);
  printf("pi (trad.)  = %10.8f\n",PI_TRAD);
  printf("pi (NAIVE)  = %10.8f\n",PI_NAIVE);
  printf("pi (EULER)  = %10.8f\n",PI_EULER);
}

Assumes that you are using gcc and glibc and may or may not work with other arrangements. It takes about 1.0-1.1 seconds of processor time (evaluated with time (1)) to compile on with -031 on my 2.4 GHz Intel Core 2 Duo MacBook. A default compile takes about 0.4 seconds of processor time.
Alas, I can't get gcc to evaluate either pow or tgamma at compiler time, which would really help.
When you run it the output is:
pi (math.h) = 3.14159265
pi (trad.)  = 3.14159265
pi (NAIVE)  = 3.11503599
pi (EULER)  = 3.14159065

which shows just how slowly the naive series converges.

1 To get as much constant folding and sub-expression elimination as possible.


text:
Bijection between binary strings and pairs thereof
Input: Either one or two strings consisting of '0's and '1's.  If there are 2, they are separated by a space. All strings are of length at least 1.
Output:

If a single input was given as input,  2 are output.
If 2 were input, 1 is output.

The output strings can be whatever you like, but if running your program with input A gives you B, then running it with B must give A (if inputting 111 11 gives 00000, then inputting 00000 must give 111 11).
That means if you pipe your program to itself, you should get back whatever you input.  If your program is called foo, you can test that like this:
>echo 101 101|foo|foo
101 101

To prevent the use of brute force techniques, your code should be able to run with 1000 digit strings in under 10 seconds.  My Python solution for this takes less than 1 second on 10000 digit strings so this shouldn't be a problem.
Shortest code wins.

Python, 183
Bijection is cached on disk.
x=raw_input()
try:d=eval(open('d').read())
except:d={'':'','1 ':'1 '}
t='1 '*not' 'in x
if x not in d:
 while t in d:t+=`(id(t)/9)%2`
 d[t]=x;d[x]=t
 open(*'dw').write(`d`)
print d[x]

edit: Oops, looks like this isn't the first smartassed answer.  Mine's consistent between runs!

You can replace if x not in d: with if(x in d)-1: and save a byte.

Python, 326
s=lambda i,l:bin(i)[2:].zfill(l)
f=lambda n:2**n*(n-3)+4
g=lambda n:2**n-2
i=raw_input()
if' 'in i:
 a,b=i.split();n=len(a+b);r=f(n)+int(a+b,2)*(n-1)+len(a)-1;l=1
 while g(l+1)<=r:l+=1
 print s(r-g(l),l)
else:
 n=len(i);r=g(n)+int(i,2);l=2
 while f(l+1)<=r:l+=1
 r-=f(l);p=r%(l-1)+1;w=s(r/(l-1),l);print w[:p],w[p:]

Example inputs/outputs:
     input | output
-----------+-----------
         0 | 0 0
       0 0 | 0
     10 10 | 10101
     10101 | 10 10
0000000000 | 101 0100
  101 0100 | 0000000000

Perl 5, 197 characters
sub n{'0'x$_[0].sprintf'%b',$_[1]}sub N{/0*(?=.)/;length$&,oct"0b$'"}$_=<>;print/ /?n map{($a,$b)=N;($a+$b)*($a+$b+1)/2+$b}split:"@{[map{$w=int((sqrt(8*$_+1)-1)/2);$y=$_-($w*$w+$w)/2;n$w-$y,$y}N]}"

With some line breaks:
sub n{'0'x$_[0].sprintf'%b',$_[1]}
sub N{/0*(?=.)/;length$&,oct"0b$'"}
$_=<>;print/ /?n map{
  ($a,$b)=N;($a+$b)*($a+$b+1)/2+$b
}split:"@{[map{
  $w=int((sqrt(8*$_+1)-1)/2);$y=$_-($w*$w+$w)/2;n$w-$y,$y
}N]}"

This program operates by composing two bijections:

A pair of natural numbers may be mapped to a binary string by converting one to a base-2 number and the other to extraneous leading zeroes. n is this function and N is its inverse (except that N uses $_ as its parameter).

A pair of natural numbers may be mapped to a single natural number using the Cantor pairing function. The first map's block is this function and the second is its inverse.

Thus two binary strings are split into four numbers, combined into two numbers, and then combined into one binary string — or vice versa.
Tested on 100 random inputs of each type with strings up to 8 symbols long. I've been finding lots of ways to make this a little bit shorter, but I'm going to stop and post it. If there's room to optimize further, it's probably in the arithmetic expressions.

The input of 1111111111111111111111111111111111111111111111111111111111111111 (64 1s) seems to crash, and input of the pair 0 and 50 1s gives the same result as 0 and 51 1s, both of which output 64 1s.  I think there's some kind of overflow with the number of leading 0s, so a solution might be to get the output N value from a Cantor pairing of input N values, and the n value from a pairing of n values (or vice versa for the inverse). I'm a perl noob though, so I might have just done something wrong.

Yes, this program is not going to work for binary strings whose 1-containing part is too big for Perl to work with as integers. I felt that was a reasonable implementation limitation in exchange for the elegance of the algorithm. In principle, all of the numeric operations could be replaced with bigint ones.

Perl, 56 chars
added +1 char for -p command line switch
$s.=1;$h{$h{$_}||=(split>1?$s:"$s $s").$/}=$_;$_=$h{$_}

Maybe I wasn't clear enough.  I want your program to take some input, print some output, and then terminate.  Then running the program again with the output as input should give back what you first input.

@cardboard_box the mapping should persist between multiple runs? you should really add that to the problem description

R, 209 bytes
Note that this code will fail for numbers outside R's native numeric range; the approach should be valid for any number, though, and this could be solved using arbitrary-precision calculations (for instance, with the R GMP library).
function(x,z=2^nchar(x)+strtoi(x,2)-1,s=function(v,l=log2(v+1)%/%1)paste((v+1)%/%2^(l:1-1)%%2,collapse=''),d=sum(cumsum(0:z)<z),y=z-sum(0:(d-1)))`if`(length(x)>1,s(sum(0:(sum(z)-2))+z[2]),sapply(c(d+1-y,y),s))

Try it online!
How does it work?
First, we convert each string x of 0s & 1s into an integer value z, corresponding to its lexicographical index.  The code for this is:
z=2^nchar(x)+strtoi(x,2)-1

And at the end of the bijection, we'll convert this back to a string using the opposite function:
s=function(v,l=log2(v+1)%/%1)paste((v+1)%/%2^(l:1-1)%%2,collapse='')

Using this scheme, the following strings correspond to the integer values 1 to 20:
sapply(1:20,string)
 [1] "0"    "1"    "00"   "01"   "10"   "11"   "000"  "001"  "010"  "011"
[10] "100"  "101"  "110"  "111"  "0000" "0001" "0010" "0011" "0100" "0101"

Now, to get a single number from a pair of numbers, we consider each number pair to be x and y coordinates of a grid, and we sequentially number each position in the grid by moving along the diagonals (so the linear sequence gradually fills the two-dimensional space):
This function calculates the number for each pair of coordinates:
num=function(c)sum(0:(sum(c)-2))+c[2]

Which leads to the following mapping:
matrix(apply(which(matrix(T,6,6),T),1,num),6,6)
     [,1] [,2] [,3] [,4] [,5] [,6]
[1,]    1    3    6   10   15   21
[2,]    2    5    9   14   20   27
[3,]    4    8   13   19   26   34
[4,]    7   12   18   25   33   42
[5,]   11   17   24   32   41   51
[6,]   16   23   31   40   50   61

The 'bijection' function just rolls all these steps together.

Python, 394
I'm sure this can be golfed further, but this monolith uses the Cantor Pairing Function and its inverse.
import math
s=lambda n:n*(n+1)/2
p=lambda a:'0'*a[0]+bin(a[1])[2:]
q=lambda t:t.index('1')
B=raw_input().split()
def f(x,y):r=x+y+1;return s(r)-[y,x][r%2]-1
def g(z):r=int(math.ceil((2*(z+1)+1/4.)**(1/2.)-1/2.))-1;d=s(r+1)-z-1;return [(d,r-d),(r-d,d)][r%2]
if len(B)<2:a=[g(q(B[0])),g(int(B[0],2))];print p(a[0])+' '+p(a[1])
else:print p([f(q(B[0]),int(B[0],2)),f(q(B[1]),int(B[1],2))])

Explanation
There is a natural association between a binary string and a pair of natural numbers: the first number of the image is the number of leading zeros, and the second is the integer value of the binary number.
Knowing that we have:
S ~ N^2
and with the Cantor bijection
N ~ N^2
therefore:
S ~ N^2 ~ N^4 ~ S^2
S ~ S^2
Where S is set of all binary strings. This solution implements the bijection between S and S^2.

Just noticed that this fails on any input that is all 0's, I'll fix it tomorrow, I'm tired of python right now -_-

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
The smallest Chess arbiter
Write a program, which, upon gazing at a chess table, can say whether there is a check or a checkmate.
Input: a chess table in text form, the last line of the input being the first rank (the starting line of White)
The starting position in this input would look like this (space is an empty square, capital letters are White): why aren't the spaces displayed here?
rnbqkbnr
pppppppp

PPPPPPPP
RNBQKBNR

The program should print one or more of the following (without quotes, of course), depending on the situation:

"The White King is in check!" (if already in checkmate, don't display this!)
"The Black King is in check!" (if already in checkmate, don't display this!)
"The White King is in checkmate!"
"The Black King is in checkmate!"
"White is in stalemate!" (There would be a stalemate if White moved - optional)
"Black is in stalemate!" (There would be a stalemate if Black moved - optional)
"Both kings are safe for now." (if none of the above apply)

The input is guaranteed to be correct and be a legal chess position (no two kings of the same color, no two kings in check, etc.).
Score:
The score is the character count, lowest wins, not sooner than 10 days after the first valid answer. If the optional stalemate evaluation is implemented, the size will be decreased by 20% (for this situation, assume en-passant cannot be performed).

I believe that stalemate can depend on who is to move (i.e. I could move out of check into a position that would be stalemate except that it is now my opponent turn to move and he'll have to change something). I'll try to manufacture such a state.

@dmckee : This is why I separated white and black. You have to print "white is in stalemate" if there would be a stalemate if white moved. I'll edit it to make it more clear.

What about unconditional stalemate (e.g. only kings left on the board)? Edit: ah, "one or more". Still, it would be good to include this in the test cases which I'm sure you're going to add.

@PeterTaylor: Well they are not technically a stalemate. One that occasion, we would have to include the King + one Knight or Bishop vs King, which is also a draw. And then the eternal check. And so on. Ok, If you want to implement it (and the unavoidable mate in x also?) you are free to do it, but I will not make them to a strict requirement. So in that case I'll accept the "Both kings are safe for now." output in case of only kings left on board.

On second thought, the checkmate condition will not be much easier to handle as the stalemate: you know, if the piece giving the check can be captured or blocked, it's not a checkmate. So if you have to handle those situations, I don't know why not go for the bonus -20% as well.

What if the check was made by a pawn eligible for en passant capture?  Is it safe to assume this does not occur?

@StevenRumbalski : yes, it's safe to assume. I didn't want to complicate things by needing to read and evaluate the last moves, so you can disregard en-passante completely. (If we knew the last move, it would be trivial to handle it, but we don't know it, so I don't expect you to handle it)

C, 837-20%=669.6 chars
Based on this answer. You can see some explanations about the implementation there.
The original is golfed quite well, the modifications not so much, so there's room for improvement.
I also wouldn't be surprised to find bugs, my QA wasn't very rigorous.
char*r=" KPNBRQ  kpnbrq $ ,&)$wxy()879()8(6:GI(",B[256],*b=B,i,Q,s,*X[]={"Stalemate","Checkmate","","Check"};
e(x,d,m,V,c,r,n,p){
    p=b[x];
    return(m/r?
        n=x+d*r,
        p-2-8*(d<0)&&!(n&136)&&(b[n]?r=8,p&8^b[n]&8&&c&65^64:c&65^65)&&
        ((V?v(n,x):b[n]%8==1&&(s&=~((b[n]>7?8:2)))),e(x,d,m,V,c,r+1))
    :0)||d>0&&e(x,-d,m,V,c,1);
}
d(x,v,m,i)char*m;{
    (i=*m-40)? e(x,i%64,b[x]%8-2?b[x]&4?7:1:(x/16-1)%5|i%2?1:2,v,i,1),d(x,v,m+1):0;
}
v(t,f){
    b[t]%8-1?
        (s&(b[f]>7?8:2))==0?
            bcopy(B,b+=128,128),
            s|=(b[f]>7?8:2),
            b[f]^=b[t]=b[f],
            a(b[t]<8,63),
            b=B
        :0
    :
        (s|=b[f]>7?1:4);
}
a(c,n){
    b[i=n*2-n%8]&&b[i]/8==c?d(i,!Q++,r+r[b[i]%8+15]-10),Q--:0;n--&&a(c,n);
}
p(c,t){
    return(t=c?s%4:s/4)!=2&&printf("%s%s%s is in %s\n",t?"The ":"",c?"White":"Black",t?" king":"",X[t]);
}
main(){
    for(;gets(b);b+=8)for(;*b;b++)*b=strchr(r,*b)-r;b=B;
    a(0,63);
    a(1,63);
    p(0)||p(8)||puts("Both kings are safe for now");
}


text:
Write a program that uses all printable non-alphanumeric ASCII symbols
In particular, use each of these symbols at least once in your source code:
! " # $ % & ' () * + , - .  / : ; < = > ? @ [ \ ] ^ _ ` { | } ~

Symbols inside comments, string literals, regexps (or any other kinds of literals etc.) don't count (but their delimiters such as /**/ or "" do count).
The program should not perform any action. It just has to compile and do nothing when run.
If for some reason some of the symbols cannot be used in the language of your choice, explain that rigorously (what and why must be excluded).
Update: A few answers used symbols withing regular expressions. I'd consider this a bit problematic, it's the same thing as putting them into string literals or comments (that's why I put etc. in that requirement). Please try without this. I also updated the requirement above.
Update: Shortest code wins (tagged as code-golf). As suggested, we'll most likely need some tie-breaker criteria. I suggest that if there is a tie, the winning one is the one in which the ASCII symbols appear as much ordered as possible. Formally: Filter out the first occurrence of each of the listed symbols from a program. This will result in a permutation on the listed symbols. The program with less inversion number of its permutation wins.
Update: I'd be happy to see some/more solutions in regular/mainstream languages, such as C(++), Java, Scala, Haskell, etc.

Is it required to do nothing, or is it just not required to do anything?

@Matt I'd prefer programs that do nothing, but don't consider it important, solutions that do something are also acceptable.

Can we have a literals exception for characters that do not appear in any keyword, syntax or operator in a particular language? That is neither @% nor the backtick can appear in c except as part of a literal (in sufficiently new versions of c % can appear in digraphs). (and # only appears in preprocessor directives, but we'll just have to live with that)? That is, I'm asking for Matt's approach to be made explicitly legal.

For that matter what about % in printf format specifiers which are formally strings, but are in some sense part of the language?

shortest code wins? i suspect there will need to be a tie-breaking criteria too

@dmckee I'd say % is inside a string literal so it should not be considered.

@dmckee, % is a C operator. But @$ and backtick are indeed problematic.

@ugoren Er...how could I forget modulus? ::sigh::

In Javascript, the characters #, @, and ` are not legal outside of any sort of literal

This is basically a competition of "find a language that can use all of these characters as syntax". Pretty crappy code gold in my opinion

Yea I agree with @Earlz, I think it would be better if it had to do something useful, in the lease amount of code, that way people couldn't just fluff to get all the characters in but it wouldn't be ardnew's solution. Cause as it stands you can't get shorter then that, plus any language in which some of the characters are not valid outside of literals - as has been pointed out by several people - are instantly disqualified. Which means there are only a few not only acceptable answers but correct answers period.

@ryan I was thinking about requiring some goal. But I fear that the results will be programs that do the goal in one part and use all characters in another. If you think it's better, feel free to start your own similar code-golf question requiring some goal. Competition benefits customers. | And to your other objection, that's why I said If for some reason some of the symbols cannot be used in the language of your choice, explain that rigorously (what and why must be excluded). In other words, you can omit those characters that aren't available in your language, if you explain it.

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

Prints a smiley face (if your console can output ASCII symbol 1)
Yay, a Branf*ck solution that beats Golfscript! :P
If you insist on no output, just exchange the + and . :
!"#$%&'()*.+-/:;>=<?@[\]^_`{|}~,

As there are no explicit comments (as in, so symbol that indicates that specific strings are part of a comment) I hope it qualifies. Brainf*ck just ignores the characters which are not part of the language, so you don't need (and can't use) comments and string literals.

Edited the order of < and > to be more interpreter-friendly

Hm... I'd rather say it does hide characters in comments, but oh well.

@leftaroundabout : They are not technically comments because you can't use them to comment out valid instructions. They are handled as whitespace. By the way, I agree with you that this is a shameless stretching of the rules.

@vsz There's nothing wrong with bending the rules.

Inversion number of this solution is 24, so it's the winner according to the rules. I have some doubts about that, as ignoring characters is very close to comments, but I'd say it's my bad, I didn't think of this possibility when writing the question.

@PetrPudlák: Just out of curiosity: How would you have dealt with this answer, if vsz just explained, that most of the requested characters are not part of the language and hence came up with a solution, that only contained a few characters? (yes, I know this thing is 4 years old)

@BodoThiesen Indeed that's quite old, I guess that might also qualify for a winning solution, although this one is better, even though it stretches the rules a little.

Perl, 32 chars
no hiding symbols in comments, string literals, or regular expressions. uses all symbols precisely once.
$`<@"^[(\{_},)]/+-~%'?&|:!*.=>;#

Description
i have tried to indicate operator precedence with indentation: the right-most expressions are evaluated before those to their left
        $`            # scalar variable $ named `
      <               # numeric less-than inequality <
        @"            # array variable @ named "
                      #   (array evaluated in scalar context)
    ^                 # bitwise XOR ^
        [(\{_},)]     # array reference []
                      #   containing array ()
                      #     containing reference \
                      #       to anonymous hash reference {}
                      #         with one key "_"
                      #           and no value (nothing following comma ,)
                      #             (reference evaluated in scalar context)
      /               # numeric division /
        +-~%'         # unary addition +
                      #   and unary negation -
                      #     and bitwise complement ~
                      #       on hash variable % named '
                      #         (hash evaluated in scalar context)
  ?                   # ternary conditional operator ?:
    &|                # code reference variable & named |
  :                   # ternary conditional operator ?:
    ! *.              # logical negation !
                      #   on typeglob variable * named .
                      #     (typeglob evaluated in scalar context)
  =>                  # fat comma => for compound expression
                      #   (evaluates LHS as string, RHS is empty)
;                     # end of expression ;
#                     # start of comment #

Correct me if I'm wrong, but did you just make a scalar called \<@"^[({_},)]/+-~%'?&|:!*.=>`?

@GigaWatt no, this is a sequence of several different expressions. i will add a description of how it is evaluated

@GigaWatt: No; in Perl, the symbolic identifiers are all single characters. Of that sort of thing, I think this program only uses $\``, @", %', and *.` (a scalar, array, hash, and typeglob, respectively), though it's awfully hard to be sure . . .

Either you're a genius, or any random byte sequence is a valid Perl program. Or both.

Although according to my own rules I had to award the Brainfuck solution, this one is my favorite (same size, but inversion number 279).

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

all non whitespace characters are ignored, so this is actually an empty program

one could argue therefor that all non-whitespace characters are comments and this is invalid :)

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

I used the characters ? and $ inside a string literal. These characters are not legal outside string literals or comments.

This contains invalid syntax. Specifically, {[\'"$?'`,]}isn't valid, as it creates a dictionary with a key with no associated value. You can make it valid with two more characters like so:{[`'"$?'`,]:0}`

@Strigoides nope, it makes a set not a dict. but even if that was the case (dict key with no value) it runs, which was the requirement, not valid syntax. (you need python >= 2.7 for it to work)

I see, I was using python 2.6 when I tested it.

PHP, 32 chars
Probably a bit of a troll, this PHP program is also a QUINE, and uses all symbols in the exact order they are listed.
!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~

Executed from the command line, the output will simply be the contents of the file, as there is no <?php to invoke the interpretor.
$ cat > a.php
!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~

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

IMHO this violates Symbols inside comments, string literals, regexps (or any other kinds of literals etc.) don't count, as the whole program is a single literal.

Also, the program required by the task should output nothing, and there is only one quine which outputs nothing.

It doesn't even get parsed by PHP so this is pretty much invalid

@RobQuist of course it gets parsed, it's busy hunting that elusive T_OPEN_TAG token right til the bitter end

Perl 6 (43 chars)
Let's define a infix operator with a rather unusual name:
sub infix:<!"#$%&'()*+,-./:;=?@[]^_´\|~>{}

It's not a literal nor a literal in a RE or anything hidden in a comment. You don't believe me? Running the following program will output "2":
sub infix:<!"#$%&'()*+,-./:;=?@[]^_´\|~>($a, $b){ $a + $b }
say 1 !"#$%&'()*+,-./:;=?@[]^_´\|~ 1;

But I'm quite sure you nitpickers will extend the rules further to exclude redefinition of the language itself to make us perl lubbers unhappy. :(

I'd say this is ok, using symbols in an identifier seems reasonable.

Haskell, 53
a@""#%&*+/?^b|a'<-a!!0=(\_->a`b`[]);main=do{print$1}

We can make this a bit shorter
45
a'@""#%&*+/?!<|^b=(\_->1`b`[]);main=do{main}

however this program doesn't terminate, and uses more characters ('!','<','|') in the newly-defined infix.

k (33 chars)
Very easy in k. Unfortunately " must be paired.
(@:'!""#$%&*+-\./;<=>?^_{}[`]|,~)

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

' needs to be doubled to avoid syntax errors.
My first answer was missing some symbols.

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

" has to be paired. It took a bit of trial and error to get it to output nothing - most other positions of the :' result in some output.

C, 48 chars
Kind of cheating.
#define _ ~''*+,-./:<=>?[]`|\
@%^$&!
main(){"";}

Definitely pushing the bounds of "cheating" as most of them appear in an uncalled macro. How about #define Q(_) "##_##" ... char*c=Q(~''*+,-./:<=>?[]|\);`. Nothing in a string, it just gets converted to one... It would be longer, of course.

@dmckee, I don't think your suggestion is more honest than mine. In both cases, the problematic characters don't end up in code. I could move most of them to code (as I did with "";), but $@ and backtick seem hopeless.

No doubt about it, mine is also foul, underhanded and sneaky. But it's fun, too.

@dmckee, fun is what it's about. BTW, you need #define Q(_) #_. The preprocessor would treat "##_##" as a string literal.

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

Results in an object on the stack, but otherwise has no effects. Postscript allows almost any char in an identifier except for <>()[]{}/ which are special syntax forms and % which introduces a comment. The program is tokenized as
{                  % start a procedure object
!"#$&'             % an identifier
()                 % an empty string
*+,-.              % an identifier
/:;=               % a symbol
<>                 % an empty hex string
?@                 % an identifier
[\]                % an array
^_`~|              % an identifier
}                  % close the procedure object
%                  % a comment

C# (91 characters)
#define a
class a{static int @Main(){return(char)1.1*""[0]/1%1-1+1!=1?1:~1^1>>1<<1&1+'\0';}}

As far as I know, The $ character is not a valid character outside string literals, so I didn't use it in my answer.
EDIT : Thanks to Peter Taylor, I shortened the code.

#if A...#endif is shorter than #region...#endregion. And "x"[0]+ is shorter than [System.STAThread].

PowerShell (52 characters)
$_+=(@(1.1,1)[0]-1)*1/1%'1'::ToInt|&{!"">~\1}<#^#>`;

I had to put the ^ character as a string literal because as far as I know, the ^ character is not a legal PowerShell character outside string literals. Correct me if I am wrong.
The only way I have found to fit in the : character is to use the :: operator to make a call to a static method.

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

This takes advantage of Scheme's incredible tolerance for characters in variable names. In this program I create a variable with the name !$%&*+,-./:<=>?@[]^_`{|}~ which Scheme happily accepts.

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

Defines a variable !#$%&'()*+,-./:<=>?@[]^\_`|~ with an empty string

C: 83 56 characters
#undef a
_;main($){$/=-+~!0|0^0%1,1<.0>0?'`':*&"@"[0];}\

At-signs and backticks are not a part of the allowed C-syntax, so I have put them between quotation marks.

Why the parenthesis in (b)? It's strange syntax and a waster of characters.

If you use the struct for the dot, 0.0 is much shorter.

How could I not think of that (0.0)? The parenthesis is a leftover from when they actually saved one character, but now they are indeed unnecessary. Thanks @ugoren!

I think main(_,$) will save a character.

And with gcc, you can write x?:y, but it isn't standard C.

main(_,$) wouldn't compile under Clang, and it wouldn't save any characters anyway. _;main($) vs main(_,$), both are 9 characters long.

Why would Clang care if main has two parameters? But the point is that , is used, allowing 2 characters to be deleted from the body (not just 1 as I wrote).

Ah, I see what you mean. What Clang doesn't allow is to have an unspecified type as a second argument to main, specifically it enforces it to be char**.

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

The main part of the above evaluates (or rather, would evaluate if not for the #+() in front of it) to the symbol named:
!#$%&()*+,-./:;<=>?@[\]^_`{}~

The #+() is to avoid output. I'm not sure if the |foo| syntax for symbols counts as a literal, but symbols are used as variable/function names in Common Lisp, and there are a few answers already using the necessary characters in those.

Smalltalk (Squeak 4.x dialect) 38 chars
Implement this method in Object, the syntax is valid if Preferences Allow underscore assignment (which is the default setting)
%&*+/<=>?@\!~y""^Z_([:z|{#'',$`;-y}]).

declare Z as global var in pop-up menu if interactive
Explanations:

%&*+/<=>?@!~ is a binary selector (an operator)
y is the parameter (the operand)
"" is an empty comment
^ means return
Z is a global variable
_ is an assignment
() delimits a sub-expression
[:z|] delimits a block of code with one parameter z
{} delimits an Array
#'' is a Symbol literal made of an empty String (first element of the Array)
, is a binary message sent to above Symbol
$` is a Character literal used as argument of above message
; is for chaining a second message sent to the same Symbol receiver #''
the second message is -
y is used as the second message argument
. is for separating next instruction (here it's a final period)

Damn, who said Smalltalk was readable?
Note that I didn't cheat, the only non valid character ` is put into a literal Character. EDIT see below, this was a false assertion (at least in Squeak)

But we can make it down to 34 chars with this trick
%&*+,-/<=>?@\!~|y""^[{#(:_;`$')}].

This time:

#() delimits a literal Array
which contains 4 literal Symbols : _ ; ` and 1 literal Character $'

Strictly speaking, we can consider this as cheating... It's not a literal String, but it is still a non empty literal...
I still have to double comment quote "" (unless I make a literal Character with it $", but then I need to double the String quote '')
I still have to use a letter for the parameter (_ is not accepted even if we set Preferences allow underscore in selector to true).
What is nice is that we can even run the method, for example send the message to 1 with argument 2:
1%&*+,-/<=>?@\!~|2

EDIT Finally in 35 chars without cheating
!%&*+,-/<=>?@`y""^[:x_|#()~$';\{}].

Notes:

Preferences allow underscore in selector enable using a block parameter named x_
` is a valid character for binary selector contrarily to what I said
I also use $' to avoid doubling a quote

R: 108 characters
a=new(setClass("a",representation(b="list")));a@b=list(c_d=1:2);if(1!='\t'&.1%*%1^1>a@b$c[1]/1|F){`~`<-`?`}#

Clearly the longest submission, but to be able to use symbols @ and $ in R, we need to create an object that has slots (indexed using @) and named elements (indexed using $).
The shortest solution I could think of was to create a new class of object (a=new(setClass("a",representation(b="list")))), which takes its toll.
Otherwise, appart from the classics that don't need explanations (such as !=, # or 1:2),
`~`<-`?`

creates a new operator that does the same as operator ? (i. e. it calls the help page of the element it precedes).
%*% computes the inner product of two matrices (here of 1^1 and .1).
Symbol _ does nothing (AFAIK) in R but is routinely used in variable or function names, as it is the case here.

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

This is not valid because the begin quote is often used for comments.

@Tyzoid I moved it to the end.

End ends a loop statement, not the program. I think you meant Return.

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

Try it online!
This technically outputs 0, but given that the empty program does that as well, I didn't see an issue with that (especially as there is no way to "output nothing" in Jelly, aside from outputting the empty string. In this case, 34 33 bytes (-1 byte thanks to xigoi)).
How it works
Jelly works by splitting its program into "links", which are compositions of "chains", which are collections of "atoms" and "quicks". 31 of the 32 characters used above are either atoms or quicks (or syntax characters), ( is the only non-implemented character. When Jelly encounters an unimplemented character outside of a string literal, it breaks the chain, essentially ignoring everything before it. So the ( breaks the program's chain, ignoring all the previous (erroring) characters. At this point, the new chain is made up of the characters after the breaking character, which in this case, is the "empty" program.
For the 33 byte version, the last byte - ⁸ - is the new chain, and is an empty list, which is then implicitly output at the end of the program as nothing

-1 byte for the “true” version by using ⁸ instead of “”.

@xigoi Oh yeah, I always forget about it’s niladic return, nice!

I'm xigoi, not xigol :)

@xigoi My mistake, corrected

Rust, 45 bytes
macro_rules!a{[r"`\"#%&'_*+-./:<?@^|~]=>{()}}

Try it online!
Creates a macro that matches when you call it with the tokens r"`\"#%&'_*+-./:<?@^|~ and returns the unit type. Do note that the backtick and backslash are inside of a string literal because that is the only valid place they can go. Also, apparently whatever stack exchange uses for syntax highlighting can't handle rust's raw strings.

CJam, 34 bytes
""`'5~*:+{i[}%-/#~|<=!$\?@,^>()_];

Try it online!
Explanation:
""`                 Push an empty string and get the string representation of that ("\"\"")
'5~*                Push a 5 character, convert it to a number, and multiply the previous string 5 times. We spend a alphanumeric char here because there's no way to use ' without wasting a char, as ' will simply accept the next character as a character and cannot be otherwise used (except in a string/char literal)
:+                  Over our string, try to do some concatenation. This doesn't really do much.
{i[}%               Convert all the characters in out string to their codepoints (34s for "). We now have a bunch of numbers on the stack. This is really nice, because CJam is strict with types but just about everything accepts numbers in some way. It's so nice that we spend a character on it.
-/#~|<=!$\?@,^>()_  Lots of meaningless operations. I just threw them in randomly and fiddled around with them so that everything would have enough operands, and we would be left with a small stack at the end
];                  Discard what we have left