Len(language,encoding)
Len(language,encoding) is not a single programming language, but rather a large family of related programming languages, inspired by Lenguage and Unary.
Syntax
Just as in Lenguage, in a Len(language, encoding) program, the length of the program is the only thing that matters. The contents can be anything the programmer wants it to be.
First, the length of the program in the given encoding is calculated. Then, said length is converted to binary, left-padded by zeroes until the binary data is valid in the given encoding, then the binary data is converted to text according to the given encoding. Finally, said text is evaluated as the given language.
For example, in Len(JavaScript,UTF-8), the program will be given as UTF-8 text, the length of the text is converted to binary, left-padded by zeroes to a multiple of 8. The binary data is interpreted as UTF-8 text, and finally run in a JavaScript interpreter.
Most programs will be too large to be practical (see examples below). This problem is compounded exponentially if, for example, you use Len(Len(Len(Javascript,UTF-8),UTF-8),UTF-8).
Example Hello World program
In Len(JavaScript, ASCII), to write a "Hello, world!" program we would start off with a JavaScript program,
alert("Hello, world!")
and then convert it to binary using the ASCII (7-bit) encoding.
1100001110110011001011110010111010001010001011100010011011100011110101110111111101000111011100100011001011101100110110011011110101100010000011101111101111111001011011001100100010000110111000100110111000111101011101111111010001110110101001
Then we would interpret that as a number in binary, (equal to 337667834225159471205607980580223574175903847313498720819759389567950249 in decimal) and then create any program we like with that many characters, such as
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ...337667834225159471205607980580223574175903847313498720819759389567950000 characters omitted
Cat program example
An example of a cat program in Len(brainfuck,ASCII) would have 12002760285 (01011001011011010111001011001011101 in binary) bytes (12GB!). Although you can store that on a disk that's large enough, you don't want to waste 12GB of disk space for that, do you?
See also
- OCPL, almost the same but not.