text:
Print a Block-Diagonal Matrix
Here is a simple, bite-sized (byte-sized?) code golf: given a non-empty list of positive integers less than 10, print a block-diagonal matrix, where the list specifies the size of the blocks, in order. The blocks must consist of positive integers less than 10. So if you're given as input
[5 1 1 2 3 1]

Your output could be, for instance,
1 1 1 1 1 0 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0 0 0 0
0 0 0 0 0 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 0 0 1 1 1 0
0 0 0 0 0 0 0 0 0 1 1 1 0
0 0 0 0 0 0 0 0 0 1 1 1 0
0 0 0 0 0 0 0 0 0 0 0 0 1

or
1 2 3 4 5 0 0 0 0 0 0 0 0
6 7 8 9 1 0 0 0 0 0 0 0 0
2 3 4 5 6 0 0 0 0 0 0 0 0
7 8 9 1 2 0 0 0 0 0 0 0 0
3 4 5 6 7 0 0 0 0 0 0 0 0
0 0 0 0 0 8 0 0 0 0 0 0 0
0 0 0 0 0 0 9 0 0 0 0 0 0
0 0 0 0 0 0 0 1 2 0 0 0 0
0 0 0 0 0 0 0 3 4 0 0 0 0
0 0 0 0 0 0 0 0 0 5 6 7 0
0 0 0 0 0 0 0 0 0 8 9 1 0
0 0 0 0 0 0 0 0 0 2 3 4 0
0 0 0 0 0 0 0 0 0 0 0 0 5

or something like that. The elements in the matrix must be separated by (single) spaces, and the rows separated by (single) newlines. There must not be leading or trailing spaces on any lines. You may or may not print a trailing newline.
You may write a function or program, taking input via STDIN (or closest alternative), command-line argument or function argument, in any convenient string or list format (as long as it isn't preprocessed). However, the result must be printed to STDOUT (or closest alternative), as opposed to returned from a function, say.
You must not use any built-in functions designed to create block-diagonal matrices.
This is code golf, so the shortest submission (in bytes) wins.
Leaderboards
I expect the array-based languages (like J and APL) to have the edge here, but I don't want that to discourage people from trying to do as well as they can in their language of choice. So here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language. So why not try and grab a spot on the latter?
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
# Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:
# Ruby, <s>104</s> <s>101</s> 96 bytes

function answersUrl(e){return"http://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function getAnswers(){$.ajax({url:answersUrl(page++),method:"get",dataType:"jsonp",crossDomain:true,success:function(e){answers.push.apply(answers,e.items);if(e.has_more)getAnswers();else process()}})}function shouldHaveHeading(e){var t=false;var n=e.body_markdown.split("\n");try{t|=/^#/.test(e.body_markdown);t|=["-","="].indexOf(n[1][0])>-1;t&=LANGUAGE_REG.test(e.body_markdown)}catch(r){}return t}function shouldHaveScore(e){var t=false;try{t|=SIZE_REG.test(e.body_markdown.split("\n")[0])}catch(n){}return t}function getAuthorName(e){return e.owner.display_name}function process(){answers=answers.filter(shouldHaveScore).filter(shouldHaveHeading);answers.sort(function(e,t){var n=+(e.body_markdown.split("\n")[0].match(SIZE_REG)||[Infinity])[0],r=+(t.body_markdown.split("\n")[0].match(SIZE_REG)||[Infinity])[0];return n-r});var e={};var t=0,c=0,p=-1;answers.forEach(function(n){var r=n.body_markdown.split("\n")[0];var i=$("#answer-template").html();var s=r.match(NUMBER_REG)[0];var o=(r.match(SIZE_REG)||[0])[0];var u=r.match(LANGUAGE_REG)[1];var a=getAuthorName(n);t++;c=p==o?c:t;i=i.replace("{{PLACE}}",c+".").replace("{{NAME}}",a).replace("{{LANGUAGE}}",u).replace("{{SIZE}}",o).replace("{{LINK}}",n.share_link);i=$(i);p=o;$("#answers").append(i);e[u]=e[u]||{lang:u,user:a,size:o,link:n.share_link}});var n=[];for(var r in e)if(e.hasOwnProperty(r))n.push(e[r]);n.sort(function(e,t){if(e.lang>t.lang)return 1;if(e.lang<t.lang)return-1;return 0});for(var i=0;i<n.length;++i){var s=$("#language-template").html();var r=n[i];s=s.replace("{{LANGUAGE}}",r.lang).replace("{{NAME}}",r.user).replace("{{SIZE}}",r.size).replace("{{LINK}}",r.link);s=$(s);$("#languages").append(s)}}var QUESTION_ID=45550;var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";var answers=[],page=1;getAnswers();var SIZE_REG=/\d+(?=[^\d&]*(?:<(?:s>[^&]*<\/s>|[^&]+>)[^\d&]*)*$)/;var NUMBER_REG=/\d+/;var LANGUAGE_REG=/^#*\s*([^,]+)/
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
<link rel=stylesheet type=text/css href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	AuthorLanguageSize

Winners by Language

LanguageUserScore

{{PLACE}}	{{NAME}}{{LANGUAGE}}{{SIZE}}Link

{{LANGUAGE}}{{NAME}}{{SIZE}}Link

J, 7 bytes
Thanks for FUZxxl for the 2-byte improvement.
Array based languages should be counted here in a different competition as they have a huge advantage. :)
   =/~@#<\

   (=/~@#<\) 3 1 1 2
1 1 1 0 0 0 0
1 1 1 0 0 0 0
1 1 1 0 0 0 0
0 0 0 1 0 0 0
0 0 0 0 1 0 0
0 0 0 0 0 1 1
0 0 0 0 0 1 1

Another 7-byte approach:
#]=@##\

Explanation for the old version ([:=/~]#<\):
The first step is generating n piece of similar things (e.g. numbers) for every list element n. These should be different from the other elements'. E.g. using the natural numbers 3 1 1 2 becomes 0 0 0 1 2 3 3.
To save on bytes we use the boxed prefixes of the list:
   ]#<\ 3 1 1 2
┌─┬─┬─┬───┬─────┬───────┬───────┐
│3│3│3│3 1│3 1 1│3 1 1 2│3 1 1 2│
└─┴─┴─┴───┴─────┴───────┴───────┘

With the =/~ verb we create a table of Descartes products of these boxed prefixes and each cell will be 1 if the two entries are equal 0 otherwise.

I don't think the parentheses around [:=/~]#<\  count towards your score. Also, =/~@#<\  for two extra bytes shaved off.

"However, the result must be printed to STDOUT (or closest alternative), as opposed to returned from a function, say." You probably need either explicit input (so it's not just a function) or explicit output.

@marinus J prints the result of an expression to stdout if it's not bound to a variable.

@FUZxxl: yes, but (=/~@#<\) is just a function. You'd have to actually apply it to something to get an expression, so you'd need explicit input (".1!:1[1), or if you want to submit a function, that function should actually print the value and not just return it (like echo@ or something).

=/~&I.

APL, 10
∘.=⍨∆/⍋∆←⎕

Example:
      ∘.=⍨∆/⍋∆←⎕
⎕:
      5 1 1 2 3 1
1 1 1 1 1 0 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0 0 0 0
0 0 0 0 0 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 0 0 1 1 1 0
0 0 0 0 0 0 0 0 0 1 1 1 0
0 0 0 0 0 0 0 0 0 1 1 1 0
0 0 0 0 0 0 0 0 0 0 0 0 1

Explanation:

∆←⎕: read input, store in ∆.
⍋∆: find permutation that sorts ∆ (this gives an unique value for each value in the input)
∆/: for each of those unique values, repeat it N times, where N is the corresponding value in the input
∘.=⍨: make a matrix comparing each value in that list to the other values.

To test this on http://tryapl.org, you might want to use the dfn {∘.=⍨⍵/⍋⍵}, as the site filters all uses of ⎕ (except for ⎕IO and stuff like that).

@FUZxxl: it says "However, the result must be printed to STDOUT (or closest alternative), as opposed to returned from a function, say.", so {∘.=⍨⍵/⍋⍵} isn't valid. You'd need {⎕←∘.=⍨⍵/⍋⍵}, which not only costs two characters but still wouldn't work on TryAPL. (And in general, TryAPL is too limited to be useful.)

If it has to print out the result, wouldn't you need a ⎕← anyway, even without the dfn?

@FUZxxl: no, the output of an expression is printed automatically if nothing else is done with it.

Ah, I see. I was under the impression that this only happens when you are using the interpreter interactively.

@FUZxxl: nope, it works from a function as well, and it does actually print the result and doesn't return it:  http://i.imgur.com/Qh8NA3a.png

That makes sense.

Replying now after 8 years, but ∘.=⍨⊢⊢⍤/⍋ is shorter and tacit.

R, 69 63
function(x)write(+outer(i<-rep(1:length(x),x),i,"=="),1,sum(x))

Test Case:
(function(x)write(+outer(i<-rep(1:length(x),x),i,"=="),1,sum(x)))(c(5,1,1,3,1))
1 1 1 1 1 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 0 1 1 1 0
0 0 0 0 0 0 0 1 1 1 0
0 0 0 0 0 0 0 1 1 1 0
0 0 0 0 0 0 0 0 0 0 1

The outer function does most of the work here, then its just a case of getting the output looking right - Thanks to @Vlo for his help with that

Very nice solution

Great solution. Never thought about using -/+ to coerce logical. Save a few bytes function(x)write(+outer(i<-rep(1:length(x),x),i,"=="),1,sum(x)) 63

Matlab, 60 54 bytes
This would be Matlab's special field IF we could use builtin functions...
Thanks @sanchises for fixing the error I missed.
c=0;a=input('');for A=a;v=c+1:c+A;d(v,v)=1;c=c+A;end;d

Wooow, it was until now that I noticed that this js snippet actually produces a leaderboard!!! How did I never notice this??? Thanks for pointing this out=)

I know, right? It's really cool!

I was about to post almost the same answer :-)

The exact same or something slightly different? =) (Well apart from variable names.)

Too similar for me to post it :-)

You forgot a +1. c=0;a=input('');for A=a;v=c+1:c+A;d(v,v)=1;c=c+A;end;d fixed and golfed to 54 characters.

Hm, strange, it worked when I developed it... but thanks for noticing! The use of d or disp(d) is desputable, since d also prints d = ... in the console, but if you think this is valid I am happy to accept it=)

@flawr well strictly speaking, disp(d) does not follow the rules either, since MATLAB prints leading spaces and multiple spaces between numbers.

Not sure if it helps, but actually you can use builtin functions. As long as they are not functions to create block diagonal matrices.

Python 3, 103 97 82 78 76 bytes
def P(L,n=0):k,*L=L;exec("print(*[0]*n+[1]*k+[0]*sum(L));"*k);L and P(L,n+k)

Using splat to take advantage of the space-separating nature of print, with a bit of recursion.

Ruby, 86 90 83 bytes
My first golf ever!
->l{n=l.reduce :+;s=0;l.map{|x|x.times{puts ([0]*s+[1]*x+[0]*(n-x-s))*" "};s+=x}}

Receives an array with the integers, prints the expected result:
$ (->l{n=l.reduce :+;s=0;l.map{|x|x.times{puts ([0]*s+[1]*x+[0]*(n-x-s))*" "};s+=x}}).call([5, 1, 1, 2, 3, 1])
1 1 1 1 1 0 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0 0 0 0
0 0 0 0 0 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 0 0 1 1 1 0
0 0 0 0 0 0 0 0 0 1 1 1 0
0 0 0 0 0 0 0 0 0 1 1 1 0
0 0 0 0 0 0 0 0 0 0 0 0 1

Edit:
Thanks to Martin Büttner for helping me shortening some things!

You can save some more characters: ->(l) can be ->l. map is shorter than each. .join(" ") can be shortened to *" ".

Matlab, 53 bytes
Though it is only one char shorter than the other Matlab fragment, I figured the code is sufficiently different to warrant a new answer:
d=[];a=input('');for A=a;v=1:A;d(end+v,end+v)=1;end;d

The main trick is of course out of bounds indexing, but this is combined with using end as a variable to make it more compact.

Damn - I spent half an hour trying to golf end+1:end+v to get rid of a 'counter' variable, and I didn't think of this solution.

Indeed, as @Geobits mentioned the attempted edit by an anonymous into blkdiag would violate the requirements. Just for reference I will put the core of it here anyway: blkdiag(A,ones(i))

APL (Dyalog Extended), 6 bytes
∘.=⍨⍸⎕

Try it online!
A full program that takes the input vector from stdin and prints the matrix.

If a function returning a matrix were allowed:
APL (Dyalog Extended), 5 bytes
∘.=⍨⍸

Try it online!
APL wins back against J and K with the extended domain for ⍸.
How it works
∘.=⍨⍸
    ⍸  ⍝ Where; convert to an array that,
       ⍝   for each element n at index i, has n copies of i
∘.=⍨   ⍝ Outer product by element-wise equality on self

CJam, 21
q~{T):Ta*~}%_f{f=S*N}

Try it at http://cjam.aditsu.net/
Explanation:
q~          read and evaluate the input array
{…}%        transform each number using the block
    T):T    increment T (initially 0)
    a*      wrap T in an array and repeat it <number> times
    ~       dump the repeated numbers so they end up in a flat array
_           duplicate the array
f{…}        for each array item and the array
    f=      compare the current item with each item, resulting in an array of 1 and 0
    S*      join with spaces
    N       add a newline

Python 3, 79
def f(l,s=0):
 for x in l:r=[0]*sum(l);r[s:s+x]=[1]*x;s+=x;exec("print(*r);"*x)

Tracks the leftmost index of the block as s and makes the x entries after it be 1, where x is the current block size. This row is then printed x times. Python 3 is needed to do print(*r).

It's one char shorter to just do express r as [0]*s+[1]*x+[0]*(sum(l)-s-x), but I'm still looking for a better way.

Haskell, 118 116 bytes
(#)=replicate
f i=putStr$[e#(unwords$sum h#"0"++e#"1"++sum t#"0")|(h,e:t)<-map(`splitAt`i)[0..length i-1]]>>=unlines

Usage: f [2,1,1,3]
Output:
1 1 0 0 0 0 0
1 1 0 0 0 0 0
0 0 1 0 0 0 0
0 0 0 1 0 0 0
0 0 0 0 1 1 1
0 0 0 0 1 1 1
0 0 0 0 1 1 1

How it works:
[0..length i-1]           for each index n of the input list i
(h,e:t)<-map(`splitAt`i)  split i at n and
                            let e be the element at index n
                            let h be the list of elements to the left of e
                            let t be the list of elements to the right of e
                          foreach triple h, e, t make a list of
sum h # "0" ++              sh copies of "0" (sh = the sum of the elements of h) followed by
e # "1" ++                  e copies of "1" followed by
sum t # "0"                 st copies of "0" (st = the sum of the elements of t)
unwords                   join those list elements with spaces inbetween
e #                       make e copies
>>=unlines                join those lists with newlines inbetween
putStr                    print

You can save two bytes by doing (h,e:t)<-map(`splitAt`i)[0..length i-1], since n is not used outside the let binding.

@Zgarb: nice find. Thanks!

K (ngn/k), 12 bytes
5:'=/:/2#,&:

Try it online!
5: is "debug print". Since the default formatting of a matrix is not what is wanted here, it is printed row-wise via '.

if function returning a matrix (list of lists) were allowed:
K (ngn/k), 9 bytes
=/:/2#,&:

Try it online!
Took almost two years to golf a byte from the previous ngn/k answer :P
The algorithm itself is the same. The problem with making something a train is that you're allowed to reference the input only once. This code solves the problem by making =/: reduce over the two copies of the vector &x.

Pyth, 23 21 bytes
GitHub repository for Pyth
Ju+G*]GHQYFNJjdmsqdNJ

Input is a list of integers, like [3, 1, 1, 2]. Try it online: Pyth Compiler/Executor
Uses a quite similar idea as randomra's J code. The first part of the code Ju+G*]GHQY generates n parts of similar things. For the example input [3, 1, 1, 2] the result looks like this:
[
 [],
 [],
 [],
 [[], [], []],
 [[], [], [], [[], [], []]],
 [[], [], [], [[], [], []], [[], [], [], [[], [], []]]],
 [[], [], [], [[], [], []], [[], [], [], [[], [], []]]]
]

First three identical elements, than one element , then one element again and at the end two identical elements.
Ju+G*]GHQY
 u      QY  reduce the input Q, start with empty list G=[]
            for each H in input, replace the value of G by:
  +G*]GH       G+[G]*H
J           store the result in J

The second part of the code is comparing the elements of the Cartesian product and printing it.
FNJjdmsqdNJ
FNJ          for N in J:
     m    J     map each element d of J to
       qdN          the boolean value of d == N
      s             and convert it to an integer (0 = False, 1 = True)
   jd           print the resulting list seperated by d (=space)

C++ , 294 bytes
Compiler used - GCC 4.9.2
#include<bits/stdc++.h>
using namespace std;
#define F(a,b) for(a=0;a<b;a++)
#define V vector<int>
int n,i,j,s,o;
main(){V v;while(cin>>n)v.push_back(n),s+=n;vector<V> m(s,V(s,0));F(i,v.size()){F(j,v[i])F(n,v[i])m[j+o][n+o]=1;o+=v[i];}F(j,s){F(n,s)cout<<m[j][n]<<((n==s-1)?"":" ");cout<<"\n";}}

Explanation -:
#include<bits/stdc++.h>
using namespace std;
#define F(a,b) for(a=0;a<b;a++)
#define V vector<int>
int n, i, j, s, o;
/*
 n = Used to take inputs, and as an iterator after that
 i, j = Iterators
 s = sum of all the inputs
 o = offset ( used to find the location of the starting cell of the next matrix of 1's )
*/

main()
{
    V v;
    while ( cin >> n )  // Take input
    {
        v.push_back( n ), s += n;
    }

    vector<V> m( s, V( s, 0 ) ); // m is a matrix of size (s*s) with all elements initialized to 0
    F( i, v.size() )
    {
        F( j, v[i] )F( n, v[i] )m[j + o][n + o] = 1; // Assign 1 to the required cells
        o += v[i]; // Add the value of the current element to the offset
    }

    F( j, s )  // Output the matrix
    {
        F( n, s )cout << m[j][n] << ( ( n == s - 1 ) ? "" : " " ); // Prevent any trailing whitespace
        cout << "\n";
    }
}

K, 30 bytes
{"i"$,/x#',:',/'g=\:\:x#'g:<x}

Basically stole marinus's answer
k){"i"$,/x#',:',/' g=\:\:x#'g:<x}5 1 1 2 3 1
1 1 1 1 1 0 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0 0 0 0
0 0 0 0 0 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 0 0 1 1 1 0
0 0 0 0 0 0 0 0 0 1 1 1 0
0 0 0 0 0 0 0 0 0 1 1 1 0
0 0 0 0 0 0 0 0 0 0 0 0 1

Python 2, 163 114 bytes
gnibbler golfed this a bunch.
h=input()
r=range
l=len(h)
for i in r(l):
 for k in r(h[i]):print" ".join("01"[i==j]for j in r(l)for x in r(h[j]))

how about print" ".join("01"[i==j]for j in r(l(h))for x in r(h[j]))?

Aha! I thought I could do something like that.

This seems to only print one row of each block.

@xnor You're right; I fixed it.

Java, 163
a->{int n=a.stream().mapToInt(x->x).sum(),t=0,j,k;for(int i:a){for(j=0;j++<i;System.out.println("\b"))for(k=0;k<n;)System.out.print(k>=t&k++<t+i?"1 ":"0 ");t+=i;}}

A consumer which accepts a list of integers.
Readable version, with boilerplate code:
java.util.function.Consumer<java.util.List<Integer>> c = a -> {
    int n = a.stream().mapToInt(x -> x).sum(), t = 0, j, k;
    for (int i : a) {
        for (j = 0; j++ < i; System.out.println("\b")) {
            for (k = 0; k < n;) {
                System.out.print(k >= t & k++ < t + i ? "1 " : "0 ");
            }
        }
        t += i;
    }
};

Invoke using:
List list = Arrays.asList(5, 1, 1, 2, 3, 1);
c.accept(list);

JavaScript (ES6), 103 107
103 bytes as an anonymous function, not counting F= (but you need this to test it)
F=l=>alert(l.map((n,y)=>(l.map((n,x)=>Array(n).fill(x==y|0))+'\n').repeat(n))
.join('').replace(/,/g,' '))

Test In Firefox/FireBug console
F([5,1,1,2,3,1])

Output
1 1 1 1 1 0 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0 0 0 0
0 0 0 0 0 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 0 0 1 1 1 0
0 0 0 0 0 0 0 0 0 1 1 1 0
0 0 0 0 0 0 0 0 0 1 1 1 0
0 0 0 0 0 0 0 0 0 0 0 0 1

Python 3, 74
def f(a,p=0):n=a.pop(0);exec("print(*'0'*p+'1'*n+'0'*sum(a));"*n);f(a,p+n)

Doesn't this terminate with an error?

@xnor yes it does!

@feersum Is that allowed? I don't see any meta post on the issue. What do you think, Martin? If it's allowed, Sp3000 can save 6 chars by getting rid of the and short-circuit.

@xnor Does the error terminate the program or only the function call? If this terminates the program, then no I don't think it's allowed. I've expressed my opinion on this here on meta. I also think if feersum was of the opinion that this is completely legit, he would have stated it in his answer instead of hoping that no one notices.

@MartinBüttner Terminate the program, if I understand what you're asking. If you were to do f([1,2,3]);print("Done"), the error would end the program after it prints the block matrix, and it wouldn't get to printing "Done".

@MartinBüttner Reading your comment again, maybe "only the function call" is what I mean. There's no error when the function is defined and stored to a variable, but only when it's called, after the block matrix is printed.

@xnor No, that's "terminate the program" for me. Well, as I said on meta, I don't think this should be allowed, but we'll have to wait a couple of days for a consensus I guess.

Octave, 49 41 bytes
@(a)(c=repelems(b=1:length(a),[b;a]))'==c

Pyth, 31 30
FbQVbjd++*]0Z*b]b*]0--sQbZ)~Zb

A pretty naive program, takes the input on stdin. This can probably be golfed more ;)
Thanks @Jakube for pointing out a wasted char
Try it here

R, 117 144 137 133 129 123 bytes
Reasonably verbose at the moment.  Should be able to shave a few more out. Gained a number of bytes formatting it correctly, but saved some swapping out the matrix for an array.
Thanks to Alex for the tip on the replacing sep with s and removing the function name.
Dropped the array completely and used a series of reps to build each line.
Although soundly beaten by Miff, his solution made me realise I could drop the s=' ' altogether.
function(i){s=sum(i);i=cumsum(i);b=0;for(n in 1:s){d=i[i>=n][1];cat(c(rep(0,b),rep(1,d-b),rep(0,s-d)),fill=T);if(d==n)b=d}}

And the test
> (function(i){s=sum(i);i=cumsum(i);b=0;for(n in 1:s){d=i[i>=n][1];cat(c(rep(0,b),rep(1,d-b),rep(0,s-d)),fill=T,s=' ');if(d==n)b=d}})(c(5,1,1,3,1))
1 1 1 1 1 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 0 1 1 1 0
0 0 0 0 0 0 0 1 1 1 0
0 0 0 0 0 0 0 1 1 1 0
0 0 0 0 0 0 0 0 0 0 1
>

You can save 2 bytes using partial matching of function parameters. In cat(), change sep= to s= since no other recognized parameters for that function begin with "s".

@Alex  Thanks, didn't realise that.  Still on a learning curve

You can save another 2 by removing f=. This gives you a function object. If you do that, you just have to stipulate that it be assigned using something like f= before running it. I didn't realize that was legit in contests like this until I saw Martin Büttner do it with Ruby.

Perl, 69
#!perl -na
$j=s/./0 x$&/ger;print+($j|$i.1x$_)=~s/\B/ /gr x($i.=0 x$_,$_)for@F

Uses standard input:
$ perl a.pl <<<"1 2 3"
1 0 0 0 0 0
0 1 1 0 0 0
0 1 1 0 0 0
0 0 0 1 1 1
0 0 0 1 1 1
0 0 0 1 1 1

strangely, this doesn't print newlines for me on ideone. also, according to this post you should code the custom shebang as 4 bytes, not two. you can fix that by not using the shebag but instead using the flags on the interpreter and calling the code with -e instead of from a file (see examples in that meta post). also, I think you don't need the n flag - according to the perldoc, a sets n implicitly.

The program reuses the eol from the standard input. Your ideone setup works when you add it. As for the character count, I count it this way in all my answers, and I've seen others do it this way too. I have seen the post you linked before, but I don't get what it means by "count the difference to perl -nl file.pl". Original perlgolf rules would count the hyphen but not the space so 3 characters in this case.

@MartinBüttner, it is all moot anyway as randomra's approach gives much shorter solution: -lna //,print join$",map$'==$_|0,@,for@,=map{(++$i)x$_}@F. BTW my version of Perl does not set -n with -a, it must be a recent addition.

Batch - 226 Bytes
@echo off&setLocal enableDelayedExpansion&set c=0&for %%a in (%*)do set/ac+=1&for /l %%b in (1,1,%%a)do (set l=&set d=0&for %%c in (%*)do (set/ad+=1&for /l %%d in (1,1,%%c)do if !d!==!c! (set l=!l!1)else set l=!l!0)
echo !l!)

Takes input from stdin (C:\>script.bat 5 1 1 2 3 1) and echo's output. Unfortunately I couldn't get that last echo on the same line, otherwise I could probably call the whole line within cmd/von/c to avoid having to enable delayed expansion the long way.
Nice and neat - nothing but grunt work:
@echo off
setLocal enableDelayedExpansion
set c=0
for %%a in (%*) do (
    set /a c+=1
    for /l %%b in (1,1,%%a) do (
        set l=
        set d=0
        for %%c in (%*) do (
            set /a d+=1
            for /l %%d in (1,1,%%c) do if !d!==!c! (set l=!l!1) else set l=!l!0
        )
        echo !l!
    )
)

Haskell, 124
(%)=replicate
d l=fst$foldr(\x(m,n)->(m>>mapM_(\_->putStrLn$unwords$n%"0"++x%"1"++(sum l-n-x)%"0")[1..x],n+x))(return(),0)l

Produces output by combining IO actions through mapM_ and foldr. The function d should be given a list of ints.

Jelly, 7 bytes
ĖŒṙ⁼þ`G

Try it online!
Same approach as the J answer.
      G    Grid format
   ⁼þ      a table of whether or not pairs of elements are equal, from
 Œṙ        the run-length decoded
Ė          enumeration of the input,
     `     compared with itself.

I think Äx might work although I can't get it to work

@emanresuA If the grid formatting weren't mandatory, Äxµ⁼þ would be shorter, but the best I can think of considering it is is Äx¹⁼þGwhich ties. Nice thinking though--and gets me thinking maybex`'s arguments should be the other way around!

K (ngn/k), 14 bytes:
{5:'x=\:x:&x;}
fixed. now prints to stdout

{x=\:x:&x}

@ngn oh come on...

this challenge had been discussed in the apl room, i knew the solution from there :) k and j have an advantage here because their "where"-s (& in k or I. in j) work with int vectors, while apl's ⍸ works only with booleans.

Julia 1.6, 68 bytes
>(L,c=0)=((x,l...)=L;print(("0 "^c*"1 "^x*"0 "^sum(l)*"
")^x);l>c+x)

Attempt This Online!
port of Sp3000's answer
needs julia 1.6 for x,l...=L
output as a matrix would save a lot of bytes but printing it as expected uses more bytes:
!L=(l=[(a=1;L.|>i->(a+=1)ones(i))...;]).==l' (44bytes)

Vyxal, 7 bytes
żẋf:v=⁋

Try it Online! -1 byte thanks to lyxal.
Same approach as a lot of the array-language answers
 ẋ      # Repeat elements of
ż       # [1...len(input)
 ẋ      # By numbers in the input
  f     # Flatten
   :v=  # Table by equality
      ⁋ # Format as grid

It seems like żẋf:v=⁋ can work for 7 bytes

Uiua, 20 bytes
4 bytes for constructing the array; 16 bytes for formatting the output :/
≡(&p↘1/⊂)∵⊂@ +@0⊞=.⊚

Try it online!
Explanation
                ⊞=.⊚ # construct the table in the same way as other array languages
             +@0     # convert numbers to characters
      /⊂ ∵⊂@         # interleave spaces (including leading space)
    ↘1               # remove said leading space
≡(&p    )            # and print each line

STATA, 155 bytes
di _r(a)
forv x=1/wordcount($a){
gl b=word($a,`x')
gl c=_N+1
set ob _N+$b
forv y=$c/_N{
g d`y'=_n>=$c
}
}
forv z=1/_N{
replace d`z'=0 if d`z'>1
}
l,noo noh

Can I test this online somewhere?

@MartinBüttner: As far as I know, there are no online compilers for Stata since it's proprietary. Same goes for languages like SAS.

TI-Basic (TI-83), 65 bytes
Ans→A
For(X,1,sum(Ans
cumSum(ʟA
Ans(C+1
For(Y,1,sum(ʟA
Output(X,2Y,Y>B and Y≤Ans
End
If X=Ans
IS>(C,0
End
Ans→B
End

It's always a good day when I get to use the IS>( command. Needs B and C to be uninitialized (or set to zero)

05AB1E, 8 bytes
Å1ƶ˜DδQ»

Outputs with 1s like the first example.
Try it online.
Å1ƶ˜ could alternatively be āsÅΓ for the same byte-count:
Try it online.
Explanation:
Å1       # Convert each value in the (implicit) input-list to a list of that many 1s
  ƶ      # Multiply each inner list by its 1-based index, so all become unique
   ˜     # Flatten the list of lists
    DδQ  # Create an equality-table:
    D    #  Duplicate the list
     δ   #  Pop both lists, and apply double-vectorized:
      Q  #  Equality check
       » # Join each inner list by spaces, and then each string by newlines
         # (after which this is output implicitly as result)

ā        # Push a list in the range [1, (implicit) input-length]
 s       # Swap so the input-list is at the top of the stack
  ÅΓ     # Pop both, and run-length decode it

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


text:
One hundred passwords
I have one hundred vaults, each one within another. Each vault has a password, consisting of a single number.

95  43  81  89  56  89  57  67  7   45  34  34  78  88  14  40  81  23  26  78  46  8   96  11  28  3   74  6   23  89  54  37  6   99  45  1   45  87  80  12  92  20  49  72  9   92  15  76  13  3   5   32  96  87  38  87  31  10  34  8   57  73  59  33  72  95  80  84  11  4   11  11  37  71  77  91  49  21  52  48  43  11  77  52  64  3   9   21  38  65  69  84  96  78  7   71  80  78  3   97

It's too hard to memorize all these passwords, and it's not safe to keep the passwords on a piece of paper. The only solution I can think of is to use a program with exactly one hundred characters. The password to the nth vault will be found by treating the first n characters of the code as a program.
Thus, the first character of the program, if run as a program by itself, must output 95. The first two characters by themselves must output 43. The entire program must output 97.
I admit that this is really hard. So just do your best. Try to make your program work for as many vaults as possible, and I'll memorize the passwords to the rest.
Rules

If there is a tie, the winner is the earliest submission.
Standard loopholes forbidden. That includes reading from other files or from the Internet.
You have a few options for the code:

A full program which prints the correct number
A function which returns or prints it
An expression which evaluates to it (e.g. in C, 4+3 evaluates to 7)

You may assume a REPL environment
You may use different techniques for each value of n. For example, you can use different languages for each n, or sometimes use a full program and sometimes a function.

Note: This scenario is completely fictional. If you have a similar issue, do not post your passwords online.

Should have used 98 characters... now every single-line submission will just cause a horizontal scrollbar. :( ... ;)

Is there a rule about the length of the program? The only solution I can think of is to use a program with exactly one hundred characters. Does this mean every program have to be exactly 100 characters?

@n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ Yes.

Standard rules allow storing info in filename as long as the bytes are  counted. How here?

><> (Fish), 95
Starting after the '  puts all characters onto the stack and at the end of the line it wraps around; closes the string with the same '; outputs the top of the stack as a number (n) and finish execution (;).
Characters for 13 and 10 were changed to space to not ruin the layout of the code (as fish is a 2D language.)
Some non-printable ASCII disappears in the answer. Correct program here.
'n;Y8Y9C-""NX(QN.`JY6%c--WP\1H  \LX `W&WX"9I;!H_PT%GM[140+M4@   &AET`NGPNa

Thanks for Martin Büttner and Sp3000 for improvements of 2 and 5 bytes.
Hex dump:
0000000: 276e 3b59 3859 3943 072d 2222 4e58 0e28  'n;Y8Y9C.-""NX.(
0000010: 5117 1a4e 2e08 600b 1c03 4a06 1759 3625  Q..N..`...J..Y6%
0000020: 0663 2d01 2d57 500c 5c14 3148 095c 0f4c  .c-.-WP.\.1H.\.L
0000030: 5803 0520 6057 2657 1f58 2208 3949 3b21  X.. `W&W.X".9I;!
0000040: 485f 5054 0b04 0b0b 2547 4d5b 3115 3430  H_PT....%GM[1.40
0000050: 2b0b 4d34 4003 0915 2641 4554 604e 0747  +.M4@...&AET`N.G
0000060: 504e 0361                                PN.a

Damn this is clever.

I assume a befunge solution would be a direct transliteration of this?

@JanDvorak Actually Befunge (even -98) would have more trouble because it doesn't have ' for string parsing, only ", and there are multiple "s in the program that would need to be replaced

I might be the only one here who would have needed help with this, but if you download the file and the ><> interpreter, you can test it using ./fish.py <(head -c 99 raw.php) where raw.php is the name that somehow ended up on the source file I downloaded.
Neat! I can't say I understand it yet...

Oh wait--reading again, it makes sense now. That's a lot simpler than I thought. Nice!

CJam, 40
I just used a greedy approach (most of the time) to print the next possible number (carets mark correct program ends):
43;56) ; 34 K- 9+ 2* ;11;3Z+;54;6;1 ;80C+K- K+G-;32 6+ 7-Z+;73(  ; 11  60+K+;52;11;64;9;65;7 8;1;8
 ^  ^ ^   ^^  ^  ^  ^  ^ ^ ^  ^ ^  ^  ^ ^  ^ ^ ^ ^ ^  ^ ^ ^  ^  ^   ^ ^^ ^ ^  ^  ^  ^ ^  ^   ^^^ ^

The following numbers are printed correctly:

95 43 81 89 56 89 57 67 7 45 34 34 78 88 14 40 81 23 26 78 46 8 96 11 28 3 74 6 23 89 54 37 6 99 45 1 45 87 80 12 92 20 49 72 9 92 15 76 13 3 5 32 96 87 38 87 31 10 34 8 57 73 59 33 72 95 80 84 11 4 11 11 37 71 77  91 49 21 52 48 43 11 77 52 64 3 9 21  38 65 69 84  96 78 7 71 80 78 3 97

Test it here.

CJam, 56
Here is a somewhat more elaborate approach. It prints the last 56 numbers correctly:
0{;"箪⇓ⲩ䏨攛믹Ğᅏꛥ훻ᆾ㼖ꦅ땶읥湓ᠤ䡶"2G#b99bW):W=}:F;FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

Chances are, SE has swallowed some characters, so here's a pastebin. You can try the code here.
It makes use of the fact, that the challenge asks for the programs in characters, so I'm using Unicode characters to encode the last 56 characters in a function, which then leaves the correct element on the stack by incrementing a variable on each invocation and selecting the corresponding element. The rest of the code just calls the function repeatedly.
The first correct program is the one ending at the second F in the code. I've fiddled around with the length of characters to be encoded for a while until I hit the right balance to make as much use as possible. One or two more might be possible with this approach.

(vintage) C - 88
No need for all these silly dedicated golfing languages. Better go back to the good old days, before the quiche eaters and their "program = algorithm+data" nonsense ruined all the fun.
The code is a C function, stored as a string.
It returns the binary value as an integer.
Run it in DosBox with Borland Turbo C 2.0.
There are no control characters in the string, so a copy-paste should work.
Compile with tiny memory model or else...
typedef int (* pfun)();
main ()
{
    pfun passwd = (pfun) "¬< sûŠDþ,#ÃEq{1Kt:=qQ+ƒ.?&m):|YH)†P$Pzs/7Tk,2o0&(CƒzIzB-E+\l^Dk‚sw.'..Hjp~T8WSN.pWc&,8Idhwƒq*jsq&„";

    printf ("password %d\n", passwd());
}

If you disassemble the start of the string, you'll see something like:
scan: lodsb
      cmp al,32
      jae scan
      mov al,[si-2]
      sub al, 35
      ret

since si is used as function address, it points directly to the code, followed by the passwords.
All values are shifted by 35 to avoid escaping control characters and double quotes.
The code is 11 bytes long, so it will work up to 12 characters.
Unfortunately, the 11th value (34) is too low to produce a valid password with an increased shift value (ret opcode is 195, so you would need a shift of 161, and the maximal shift to avoid a rollover is 255-99=156).
11 characters will produce a wrong value, and your virtual PC will experience severe (and usually lethal) undefined behaviours with 10 characters or less.

Pyth, 92 93
+_32Ce"c'MBBnx.Hq7:nN(+<#j&7yVE&M!Mwp,|4Qh)|/l-#%@wFw?*B(Yi[Ahpt+$++Egm{Q5TPK+mT`#)5Faetn'gpn#

The above code will obviously be messed up because SE removes control characters, so find the actual code here
The logic is simple, the string is the character representation of each number, except for the first 3 which are used by the conversion logic and some quotes and newlines which I replaced with dummy characters.
I will try to increase the score here.
Try it online here

If you can remove an offset from the printable character at the beginning of your code you can print the 10, 13 an 34's too.

The program seems to have more than 100 characters, which breaks the rule if I understand the question correctly.

@n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ I think that is just due to copy pasting. Some tab character getting converted to space and likewise.

@Optimizer: Oh, I see. Can you provide a copy on gist or something? Or a hex dump?

Matlab 37 39
You can use part (without the semicolons) of this idea with any programming language you like, that prints the results directly to console. This will produce at least 39 times the right answers. (I did not check those where only a half number might give a correct answer, but I've found two so far.)
43+13+11-33+54;81;78;8+20;74+15-83;01+79-59-12+6-2;;87+0-53+39;72;;11+00+66-56+22;52;3*7+48;78-7+7+0

Sorry, what am I doing wrong? code="43+13+11-33+54;81;78;8+20;74+15-83;01+79-59-12+6-2;;87+0-53+39;72;;11+00+66-56+22;52;3*7+48;78-7+7+0"; key="95 43 81 89 56 89 57 67 7 45 34 34 78 88 14 40 81 23 26 78 46 8 96 11 28 3 74 6 23 89 54 37 6 99 45 1 45 87 80 12 92 20 49 72 9 92 15 76 13 3 5 32 96 87 38 87 31 10 34 8 57 73 59 33 72 95 80 84 11 4 11 11 37 71 77 91 49 21 52 48 43 11 77 52 64 3 9 21 38 65 69 84 96 78 7 71 80 78 3 97".split(" "); res=0; for(q=0; q<100; ++q) try{ if(eval(code.substr(0,q+1))==key[q]) console.log(++res,q+1,key[q]) } catch(e) {} - it shows only 28 matches

And after posting my code and copying it from there result becomes 18 from 28... Are there any nonprintable symbols anywhere? Yes, found them:  after 00+

There should not be any nonprintable symbols, but perhaps some of them got sneaked in since it is handtyped. The only symbols used are those fourteen: 012345679+-*;

Python 3, Score 71
sum(*open(__file__,'br'))%112#M_Q]:D,*i,P(1S#=1fr@g?18[V1bV'at'iwp"v~FTlkPBW|3v|t|^)@yn%^

Try it online!
Note: the code contains unprintable char
Read the code source, and sum all the char value modulo 112 (to include the comment sign #. Then adjust each value with the right char in a comment

Python 2, 39
I wrote a script that tries lots of combinations of expressions, and tests them against the safe combinations. The best I could manage was 39 matches. I was surprised how many combinations resulted in the score of 39. I have included a sample in my answer.
I tried including the logical ^&| operators but the precedence rules got complicated.
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2*5+82+0-53+39 -1+8-76+33+54-39-41*0-43/3+46-6-7*011
43+13+11-33+54/8-14-18+3-8+3+48*0 -5+79-60-11+67-71+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2+19 +6-7+3+39 -1+12-73 +66-56+22 +9-43/3+46-6-7*011
43+13+11-33+54/8-14-18+3+63/5+14 +8+0-33+8-11+67-71+82+0-53+39 -1+8-76+33+54-39-9 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35+63/5+14 +8+0-33+8-11+67-71+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35+63/5+14 +8+0-33+8-11/2-2+19 +6-7+3+39 -1+8-76+33+54-39-9 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48+45-54-33+8-11/2-2*5+82+0-53+39 -1+12-73 +66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48+45-54-33+8-11/2-2+19 +6-7+3+39 -1+8-76+7+66-56+22 +9-43/3+46-6 +2+17
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2*5+82+0-53+39 -1+8-76+33+54-39-9 +9-43/3+46-6-7-681
43+13+11-33 -20 +9+23-35-8+3+48+45-54-33+8-11/2-2*5+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6 +2+17
43+13+11-33 -20 +9+23-35+63/5+14 +8+0-33+8-11+67-71+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6 +2+17
43+13+11-33 -20 +9+23-35-8+3+48+45-54-33+8-11/2-2*5+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7*011
43+13+11-33+54/8-14-18+3-8+3+48*0 -5+79-60/7-57-2*5+82-56+3+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35+63/5+14 +8+0-33+8-11/2-2+19 +6-7+3+39 -1+12-73 +66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60-11+67-71+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7-681
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2+19 +6-7+3+39 -1+12-73 +66-56+22 +9-43/3+46-6 +2+17
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2*5+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7*011
43+13+11-33+54/8-14-18+3-8+3+48*0 -5+79-60/7-57-2*5+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60-11+67-71+82-56+3+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35+63/5+14 +8+0-33+8-11+67-71+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7-681
43+13+11-33+54/8-14-18+3-8+3+48*0 -5+79-60/7-57-2*5+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6 +2+17
43+13+11-33 -20 +9+23-35-8+3+48+45-54-33+8-11+67-71+82+0-53+39 -1+8-76+33+54-39-9 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2*5+82-56-23+51+36-84+00+66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+20+14 +8+0-33+8-11+67-71+82+0-53+39 -1+8-76+33+54-39-41*0-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2+19 +6-7+3+39 -1+12-73+60-22+3-41*0-43/3+46-6 +2+17
43+13+11-33+54 -7 -35-35-8+3+48*0 -5+79-60/7-57-2*5+82+0-53+39 -1+8-76+33+54-39-41*0-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35+63/5+14 +8+0-33+8-11/2-2*5+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6 +2+17
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2+19 +6-28+47+2+36-84+00+66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+20+14 +8+0-33+8-11+67-71+82+0-53+39 -1+8-76+33+54-39-9 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2+19 +6-28-2+51+36-84+00+66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60-11/2-2*5+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6 +2+17
43+13+11-33 -20 +9+23-35+63/5+14 +8+0-33+8-11/2-2*5+82+0-53+39 -1+8-76+33+54-39-9 +9-43/3+46-6-7-681
43+13+11-33+54 -7 -35-35-8+3+48*0 -5+79-60-11/2-2*5+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6 +2+17
43+13+11-33+54 -7 -35-35-8+20+14 +8+0-33+8-11/2-2+19 +6-7+3+39 -1+12-73 +66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2+19 +6-28-2+51+36-84+00+66-56+22 +9-43/3+46-6 +2+17
43+13+11-33 -20 +9+23-35-8+20+14 +8+0-33+8-11/2-2*5+82-56+3+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7-681
43+13+11-33+54/8-14-18+3-8+3+48*0 -5+79-60/7-57-2*5+82+0-53+39 -1+8-76+33+54-39-9 +9-43/3+46-6 +2+17
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2*5+82+0-53+39 -1+12-73+60-22+3-9 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60-11/2-2*5+82+0-53+39 -1+8-76+33+54-39-9 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2+19 +6-7+3+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48+45-54-33+8-11/2-2*5+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7-681
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2*5+82-56+3+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2*5+82+0-53+39 -1+8-76+33+54-39-9 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+20+14 +8+0-33+8-11+67-71+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7-681
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2*5+82-56+3+39 -1+8-76+33+54-39-9 +9-43/3+46-6-7-681
43+13+11-33+54/8-14-18+3-8+3+48*0 -5+79-60-11/2-2*5+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6 +2+17
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2*5+82-56-23+51+36-84+0+60-22+3-9 +9-43/3+46-6-7-681
43+13+11-33+54/8-14-18+3-8+20+14 +8+0-33+8-11/2-2*5+82-56+3+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48+45-54-33+8-11/2-2+19 +6-7+3+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48+45-54-33+8-11/2-2+19 +6-28-2+51+36-84+0+60-22+3-41*0-43/3+46-6-7*011
43+13+11-33+54 -7 -35-35-8+20+14 +8+0-33+8-11/2-2*5+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+20+14 +8+0-33+8-11/2-2*5+82-56+3+39 -1+8-76+33+54-39-9 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35+63/5+14 +8+0-33+8-11/2-2*5+82+0-53+39 -1+8-76+33+54-39-9 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+20+14 +8+0-33+8-11/2-2*5+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7*011
43+13+11-33+54/8-14-18+3-8+3+48*0 -5+79-60-11/2-2*5+82+0-53+39 -1+8-76+33+54-39-9 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60-11/2-2*5+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7-681
43+13+11-33 -20 +9+23-35-8+3+48+45-54-33+8-11/2-2*5+82-56+3+39 -1+8-76+7+66-56+22 +9-43/3+46-6 +2+17
43+13+11-33+54/8-14-18+3-8+3+48*0 -5+79-60/7-57-2*5+82-56-23+51+36-84+00+66-56+22 +9-43/3+46-6-7-681
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2+19 +6-7-23+51+36-84+00+66-56+22 +9-43/3+46-6-7*011
43+13+11-33+54/8-14-18+3-8+3+48*0 -5+79-60-11/2-2+19 +6-7+3+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7-681
43+13+11-33 -20 +9+23-35+63/5+14 +8+0-33+8-11+67-71+82-56+3+39 -1+12-73 +66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35+63/5+14 +8+0-33+8-11/2-2*5+82-56-23+51+36-84+00+66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60-11/2-2*5+82+0-53+39 -1+12-73 +66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60-11/2-2*5+82-56+3+39 -1+12-73 +66-56+22 +9-43/3+46-6-7-681
43+13+11-33+54/8-14-18+3-8+3+48*0 -5+79-60/7-57-2+19 +6-7+3+39 -1+8-76+7+66-56+22 +9-43/3+46-6 +2+17
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60-11/2-2+19 +6-7+3+39 -1+8-76+33+54-39-41*0-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2*5+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6 +2+17
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2*5+82+0-53+39 -1+12-73+60-22+3-41*0-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35+63/5+14 +8+0-33+8-11/2-2+19 +6-7-23+51+36-84+00+66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2*5+82+0-53+39 -1+8-76+33+54-39-41*0-43/3+46-6 +2+17
43+13+11-33 -20 +9+23-35-8+20+14 +8+0-33+8-11/2-2*5+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6 +2+17
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2+19 +6-7+3+39 -1+8-76+33+54-39-41*0-43/3+46-6-7-681
43+13+11-33+54 -7 -35-35-8+3+48*0 -5+79-60/7-57-2+19 +6-7+3+39 -1+8-76+7+66-56+22 +9-43/3+46-6 +2+17
43+13+11-33 -20 +9+23-35-8+20+14 +8+0-33+8-11/2-2*5+82+0-53+39 -1+12-73+60-22+3-9 +9-43/3+46-6-7*011
43+13+11-33+54 -7 -35-35-8+3+48*0 -5+79-60/7-57-2*5+82+0-53+39 -1+8-76+33+54-39-9 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2*5+82-56-23+51+36-84+0+60-22+3-9 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2*5+82+0-53+39 -1+12-73 +66-56+22 +9-43/3+46-6 +2+17
43+13+11-33+54/8-14-18+3-8+3+48+45-54-33+8-11/2-2*5+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6 +2+17
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60-11+67-71+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7*011
43+13+11-33+54/8-14-18+3-8+20+14 +8+0-33+8-11/2-2*5+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+20+14 +8+0-33+8-11+67-71+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+20+14 +8+0-33+8-11/2-2*5+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7-681
43+13+11-33 -20 +9+23-35-8+20+14 +8+0-33+8-11+67-71+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6 +2+17
43+13+11-33 -20 +9+23-35-8+3+48+45-54-33+8-11/2-2*5+82-56-23+51+36-84+0+60-22+3-9 +9-43/3+46-6 +2+17
43+13+11-33 -20 +9+23-35-8+20+14 +8+0-33+8-11/2-2*5+82+0-53+39 -1+12-73 +66-56+22 +9-43/3+46-6-7*011
43+13+11-33+54/8-14-18+3+63/5+14 +8+0-33+8-11/2-2*5+82+0-53+39 -1+12-73 +66-56+22 +9-43/3+46-6 +2+17
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60-11/2-2*5+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2*5+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7-681
43+13+11-33 -20 +9+23-35-8+20+14 +8+0-33+8-11/2-2+19 +6-7+3+39 -1+8-76+33+54-39-9 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60-11/2-2+19 +6-7+3+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2*5+82+0-53+39 -1+12-73+60-22+3-9 +9-43/3+46-6-7-681
43+13+11-33 -20 +9+23-35-8+20+14 +8+0-33+8-11/2-2+19 +6-7+3+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+20+14 +8+0-33+8-11+67-71+82+0-53+39 -1+12-73 +66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35+63/5+14 +8+0-33+8-11+67-71+82+0-53+39 -1+12-73 +66-56+22 +9-43/3+46-6-7*011
43+13+11-33+54 -7 -35-35+63/5+14 +8+0-33+8-11/2-2*5+82-56-23+51+36-84+00+66-56+22 +9-43/3+46-6 +2+17
43+13+11-33+54/8-14-18+3-8+3+48*0 -5+79-60/7-57-2*5+82+0-53+39 -1+12-73+60-22+3-9 +9-43/3+46-6 +2+17
43+13+11-33+54/8-14-18+3-8+3+48+45-54-33+8-11/2-2*5+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2*5+82+0-53+39 -1+12-73 +66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2*5+82-56+3+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7-681
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2*5+82-56+3+39 -1+8-76+33+54-39-9 +9-43/3+46-6-7*011
43+13+11-33+54/8-14-18+3+63/5+14 +8+0-33+8-11/2-2*5+82-56+3+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7-681
43+13+11-33 -20 +9+23-35+63/5+14 +8+0-33+8-11/2-2*5+82+0-53+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7*011
43+13+11-33+54/8-14-18+3-8+3+48*0 -5+79-60/7-57-2*5+82+0-53+39 -1+8-76+33+54-39-9 +9-43/3+46-6-7*011
43+13+11-33+54/8-14-18+3+63/5+14 +8+0-33+8-11/2-2+19 +6-7+3+39 -1+8-76+7+66-56+22 +9-43/3+46-6-7*011
43+13+11-33 -20 +9+23-35-8+3+48*0 -5+79-60/7-57-2+19 +6-7+3+39 -1+8-76+33+54-39-9 +9-43/3+46-6-7*011

DEBUG.COM, 93
0000h: BE FF 00 01 CE AC CC 67 07 45 34 34 78 88 14 40
0010h: 81 23 26 78 46 08 96 11 28 03 74 06 23 89 54 37
0020h: 06 99 45 01 45 87 80 12 92 20 49 72 09 92 15 76
0030h: 13 03 05 32 96 87 38 87 31 10 34 08 57 73 59 33
0040h: 72 95 80 84 11 04 11 11 37 71 77 91 49 21 52 48
0050h: 43 11 77 52 64 03 09 21 38 65 69 84 96 78 07 71
0060h: 80 78 03 97

Usage:
DEBUG.COM FILENAME.COM
G

and the result appears in AL

source: Stack Exchange

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

authors: n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳

sort: votes


text:
Recognize Twin Primes by Crashing
Background Story
Bob was handed the following assignment for his programming class. Please note: this is not the actual challenge.

Homework assignment 11: Twin primes
Input: an integer n ≥ 8, taken from STDIN.
Output: a message to STDOUT, depending on n:

If n is not a prime number, output Not prime.
If n is a prime number, but neither of n - 2 and n + 2 is, output Isolated prime.
If n and n + 2 are both prime numbers, output Lower twin prime.
If n and n - 2 are both prime numbers, output Upper twin prime.

Bob tried hard to solve the assignment, but his program kept crashing, and in the end, he gave up and submitted it in hope of partial credit. Nevertheless, Bob's program has the curious property that even though it never does what it's supposed to, the input is still classified correctly depending on the program's behavior: non-primes result in no output, isolated primes in a crash, lower twin primes in an infinite loop with no output, and upper twin primes in an infinite loop that keeps printing the correct message.
The Task
Your task is to replicate the behavior or Bob's solution. In other words, write a program that reads a single integer n ≥ 8 from STDIN or closest equivalent, and does the following:

If n is not a prime number, output nothing and exit gracefully.
If n is a prime number, but none of n - 2 or n + 2 is, produce a runtime error of some kind. Stack overflows count as runtime errors.
If n and n + 2 are both prime numbers, output nothing, but keep running until the program is killed manually (or until you run out of memory).
If n and n - 2 are both prime numbers, repeatedly output Upper twin prime., with or without a trailing newline, to STDOUT or closest equivalent until the program is killed manually (or until you run out of memory).

Incorrect inputs can be ignored.
Scoring
The idea is that your program should appear correct, but contain hidden bugs that result in the above behavior. Your program should also be short (since programming assignments are graded by hand), but popularity is more important. Thus, your score is number of upvotes - (byte count / 100), higher score being better. Note that your score can be negative.

Ughh, you ruined the question in the last paragraph :/

@Optimizer I wanted to have a go at something else than a code-golf for once, and I though of this. I'm still open to making it a pure golf, though, since there are no answers yet.

Its my personal liking towards code-golf. Don't change the scoring based on it :)

I would have preferred a pure code golf, but I still like the backstory. I'm wondering how a clear-cut golf solution would score in terms of popularity.

What should happen for n = 5?

@Théophile n = 5 is an incorrect input, and can be ignored.

Do you get extra points if the program crashes your computer? Or perhaps emails your credit card information to someone?

@Alex I prefer not to give a bonus for crashing the OS, since it would annoy people who may want to actually test the submissions. But if your program emails your credit card info to me, I'll give you a $20 bonus.

I'm voting to close this question as off-topic because underhanded challenges are no longer on-topic on this site. http://meta.codegolf.stackexchange.com/a/8326/20469

TI-BASIC, ~269
Input N
Lbl 1
2→P                                       :"  test N for divisibility by each prime
Lbl 2
If int(N/P)=N/P:Goto 3    :"composite"
If PP>N:Goto 4
P+1→P
Goto 2
Lbl 3
Disp "                NOT PRIME.               "
Stop
Lbl 4
If int((N+2)/3)=(N+2)/3                    :" determine which nearby value to test
Then:N-2→R
Else:N+2→R
End
2→P
Lbl 5
If int(R/P)=R/P:Goto 6    :"composite"
If PP>R:Goto 7
P+1→P
Goto 5
Lbl 6
Output("ISOLATED PRIME.")
Lbl 7          :" TI-BASIC how two ways of printing:
               :" Disp goes to the main screen,
               :" and Output goes to the graphical screen.
               :" This program uses both methods.
If R=N+2:Goto 5              :" go to print "lower twin prime"
Disp "UPPER TWIN PRIME"
Goto 7          :" only 16 chars can be printed per line, so we'll do the period separately (last line of program)
Lbl 5
Output("LOWER TWIN PRIME")
Lbl 7
Disp "."

 The NOT PRIME string has sixteen leading spaces, so nothing (except an ellipsis) will be printed, as noted in the comments.
 The ISOLATED PRIME string uses the Output() function, which requires two numbers (the coordinates of the printing location). This triggers an Argument Error.
 The LOWER TWIN PRIME string is indicated by the link to Lbl 5, which was already defined as the start of the twin prime test, causing an infinite loop.
 The UPPER TWIN PRIME string is followed by a link to the period, but Lbl 7 was already defined above, triggering an infinite loop.

GOTO Considered Harmful

@cat there is no better way of doing it  in TI-Basic. Plus GOTO considered harmful means just dont use it in excess

CJam - 163 bytes
{:S;0:I;{SI=__31>\127<&{oI):I;}{S\-;0:I;}?IS,<}gNo}:P;ri:Xmp{X2+mp{"Lower twin prime."P}{X2-mp{"Upper twin prime."P}{"Isolated prime."P}?}?}{"Not prime":P}?;

You can try it at http://cjam.aditsu.net/ , but in the "upper twin prime" case, you can only see the output if you use the java interpreter as the online interpreter waits for the program to finish before showing the output.
Bob started to write the program in CJam, but kept getting some weird errors so he suspected that he got some invalid characters somewhere. In an attempt to debug the issue, he implemented his own print function that checks every character:
{                     begin
    :S;               store the argument in S
    0:I;              initialize I with 0
    {                 do..
        SI=__         get the I'th character and make 2 more copies
        31>\127<&     check that the character code is strictly between 31 and 127
        {             if true
            oI):I;    print the character and increment I
        }{            else
            S\-;      remove the character from S
            0:I;      start again from 0
        }?            end if
        IS,<          check if I < length(S)
    }g                ..while the above is true
    No                print a newline
}:P;                  end function P

He tested the function, e.g. "foo"P, and it worked fine.
Then he wrote the main code:
ri:X                                read token, convert to integer and store in X
mp{                                 if X is prime
    X2+mp{                          if X+2 is prime
        "Lower twin prime."P        print "Lower twin prime."
    }{                              else
        X2-mp{                      if X-2 is prime
            "Upper twin prime."P    print "Upper twin prime."
        }{                          else
            "Isolated prime."P      print "Isolated prime."
        }?                          end if
    }?                              end if
}{                                  else
    "Not prime."P                   print "Not prime."
}?                                  end if

The algorithm seems perfectly fine, yet the program does what the question says... so poor Bob is really stumped.
Hint 1:

 The program at the top is not 100% identical to the program in the explanation

Hint 2:

 While the P function works fine for normal strings, it has a bug when dealing with invalid characters

Hint 3:

 The number of characters in the code is not equal to the number of bytes

Full explanation:

 - "S\-;" does the character removal but does not modify S, so if S has invalid characters, P goes into an infinite loop.
 - The "Lower twin prime." and "Upper twin prime." strings have a zero-width space (unicode character) at the beginning and end, respectively; thus the first one loops without printing anything and the 2nd one loops after printing the correct message
 - The last lines in the explanation should actually be:
 "Not prime":P - store "Not prime" in variable P, leaving it on the stack
 }? - end if
 ; - pop value (resulting in no output for "Not prime":P and error for "Isolated prime."P since the stack is empty after printing)

Tcl, 2416
# This function is copied from http://wiki.tcl.tk/5996,
# which is in public domain according to http://wiki.tcl.tk/4381
proc primetest n {
    set max [expr wide(sqrt($n))]
    if {$n%2==0} {return [list 2 [expr $n/2]]}
    for {set i 3} {$i<=$max} {incr i 2} {
        if {$n%$i==0} {return [list $i [expr $n/$i]]}
    }
    return 1
}

set n [gets stdin]
                                          # Input n.
set result ""
                                          # Some initialization which seemed to be useless.
if {[primetest $n]==1} {
                                          # In Tcl, { opens a string where everything in
  if {[primetest [expr {$n-2}]]==1||[primetest [expr {$n+2}]]==1} {
                                                                       # it isn't escaped.
    if {[primetest [expr {$n-2}]]==1} {
                                          # Needless to say, The closing character for
      set result "Upper twin prime.\n";
                                          # those strings is obviously }; while 1 {
      puts -nonewline $result
                                          # corresponds to the 1 matching }; there can
    } {
                                          # be more matching pairs of { } between them.
      set result "Lower twin prime.\n"
                                          # Escaped braces like \{ \} don't match each
      puts -nonewline $result
                                          # other, but the backslashes won't be removed
    }
                                          # so \{ won't become {. This kind of strings
  } {
                                          # worked well in representing blocks of code.
    set result "Isolated prime.\n"
                                          # And control structures like if, for, while,
    puts -nonewline $result
                                          # and even functions just take strings as
  }
                                          # parameters and evaluate them when necessary.
} {
                                          # After the } closing an if statement, there can
  set result "Not prime.\n"
                                          # be another parameter for the else block.
  puts -nonewline $result
                                          # Read the above comments carefully if you didn't
}
                                          # find the underhanded part yet.

I wrote this before realizing there can't be end of line comments in Tcl. So this became ugly and more suspicious. But well...

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