From Esolang
Jump to navigation Jump to search

Len(language,encoding) is not a single programming language, but rather a large family of related programming languages, inspired by Lenguage and Unary.


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.


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

   ...337667834225159471205607980580223574175903847313498720819759389567950000 characters omitted