TrollScript, an esoteric dialect of Brainfuck.
github.com
github.com
I think that is where these kinds of languages are used. I think the idea is to test how fast a programmer can learn something new. (For the most part, I'm doubtful about these tests.)
I don't think so. Rather it's that technology jobs (and others, surely) often confront frustrating, confounding, and even downright impossible tasks. The ability to identify a situation as impossible or otherwise -- to drill down to the point of conflict -- is prized, as well as the ability to keep it together mentally and keep plugging away.
>,[[>,]]<[.<]
edit: of course it should be
>,[>,]<[.<]
pStr++;
*pStr = getc(stdin); //or wherever
while *pStr {
pStr++;
*pStr = getc(stdin);
}
pStr--;
while *pStr {
putc (*pStr, stdout)
pStr--;
}
It'll print the reverse of a string, but it will also print everything before it until it hits a null byte. I'd add <[-]
to the beginning to null out the preceding byte and hope it wasn't important.As silly as brainfuck seems, I could see something like it being used in nanobots (should such a thing ever come to pass), where memory would be at a severe premium.
exactly! The brainfuck execution starts with the pointer at the first byte of zero-filled array:
http://www.muppetlabs.com/~breadbox/bf/
So the first ">" in my program moves the pointer to the next byte, and this skipped first byte would serve as a stopper when pointer moves back.
It's an interesting language, and one that I'm not convinced is so entirely without practical application as is commonly stated.
In addition, there's also a JVM port of TrollScript in the works, which will add a static type system to the language for troll-safety. This should alleviate any concerns that the language would be unmaintainable for large systems. JTrollScript will also have type inference to maintain the terseness of the original language.
my buddy has been hacking on this and he says the benefit of being able to troll on the server the same way you troll the client is a huge benefit.
That said, Brainfuck originally had an at least interesting purpose: The idea was to create a language that could be handled by the smallest possible compiler.
AFAIK a Brainfuck compiler can be implemented in less code than a compiler for any other Turing-complete language.
Still not practical, but interesting nonetheless.
https://raw.github.com/gist/1204925/743626cf2313690d82243e99...
Have it sung to you on OS X: $(curl https://raw.github.com/gist/1204925/743626cf2313690d82243e99... | say -v "Bad News")
Then you can execute any DNA string ;)
str.scan(/.{3}|.{1,2}$/).each do |bit|
process(bit)
endhttps://github.com/Wollw/BrainScript
I wrote it using Guile 1.8.7 and I have no idea if I'm using Guile specific features or not.
edit: Seems it's still a bit broken. The reverse string example in this thread doesn't work for example.
edit2: Well the reverse string example works now. I changed it to read the EOF as equal to 0.
https://github.com/danieldk/brainfuck-pl
Why? Because it can be done. And actually prolog's tracing mechanism makes debugging brainfuck code quite insightful.
Deleted comment
Trooloolooloolooloolooloolooloolollooooolooloolooloolooloolooooolooloolooloolooloolooloolooloooooloolooloooooloooloolooloololllllooooloololoooooololooolooloolooloolooloololoolooolooloololooooooloololooooloololooloolooloolooloolooloolooloolooloolooloololooooolooolooloololooollollollollollolllooollollollollollollollollloooooololooooolooll.