What is the least amount of code you can write to create, sort (ascending), and print a list of 100 random positive integers? By least amount of code I mean characters contained in the entire source file, so get to minifying.
I'm interested in seeing the answers using any and all programming languages. Let's try to keep one answer per language, edit the previous to correct or simplify. If you can't edit, comment?
Javascript: (via JSDB or Mozilla's Rhino used in shell mode)
Here's a full test run:
edit: looks like I can shorten it a few chars by direct assignment rather than "push", and I don't need the {}s:
groovy:
plain old c-code in 167 chars:
10 characters in J:
explanation:
/:~
sorts an array (technically, applies a lists sorted permutation vector to itself)x ? limit
returns x random numbers less than limit9e9
(9000000000) is a reasonable upper limit expressible in 3 characters. !9 (9 factorial) is smaller, but requires one less character.Common Lisp, int between 0 and 10000 (there is no upper bound for that, but you have to choose one).
He said the least chars, not the least bytes. =)