Did you know it’s possible to write Javascript code without using any letters or numbers at all? Well, it’s not just Javascript, but that’s the language used in this demonstration. [Patricio Palladino] shows how code can be written using just eight characters, and all of them are punctuation marks.
Typecasting is the name of the game here. By starting out with an empty array formed by a pair of square brackets, [Patricio] can generate the number zero by casting the array with the plus sign. From there he can use an exclamation point (a boolean cast) and addition to generate any number. The image above is an example of the digits 0-9. This would get very tedious for larger numbers but there’s another shortcut. Cast the digits to strings, concatenate them, then cast back to a number and you’re in business.
The technique is fascinating, and basically unreadable. As a proof of concept he wrote a parser that will convert any Javascript into this hieroglyphy. Check out his Github repository to give it a try.
[via Reddit]
Heh, reminds me of Church numbers.
I already knew about this method but I guess it’s useless except for obfuscation and blowing things up ;)
Anyway looking at this reminds me totally of Brainfuck
Clean and Dirty, Perl has this beat. :)
I just tried it out,
MOD EDIT: holy crap use pastebin, people.
actually executes! and does what it is supposed to!
there needs to be a way to compress that…
holy crap it does work :)
Holy crap, is there no post length limit?!
tl;dr
Brought my poor old iPhone 4 to a crawl,cheers ;)
I prefer BrainFuck.
I prefer this one. Also is the most ink-efficient language when printed.
Georg Cantor says hello.
I love this one.
http://utf-8.jp/public/jjencode.html
Reminds me of when I proved HTMLgoodies wrong in High School – the site said there was NO way to display an image using only a single web page in HTML with no IMG tags. It only worked in Netscape but I showed you could use a table of 1px cells with background colors.
The code took far more space than the image file would have, but it was a solution.
Nowdays you can use data-url and inline the graphics right with them html codez
What, you didn’t use run length encoding and colspan to bring the size down?
Set theory FTW!
And the Lifetime Achievement Award for Obfuscated Code goes to…
This was fun. Java, Perl, .. Lua script?..