Tag Archives: Brainfuck

Messing with Brainf*ck

Well, a couple of nights ago, I started toying with Brainfuck, for no reason other than I was just bored.

I was talking to a colleague about a Brainfuck interpreter on my Nintendo Wii, this was just a little bit of fun, but yesterday, he couldn’t sleep, as some of you may know, I work for a company that writes an APL Interpreter, so we’re not new to strange languages. What’s more obscure than APL, well, there’s loads of them, and Brainfuck is one of these. But how could we make use of obscure languages together? well, as Nic couldn’t sleep, he decided to write a Brainfuck Interpreter…. in APL…

For those that don’t know Brainfuck, here’s “Hello World!” in Brainfuck.
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.

I’m not going to show all the code in here for the Brainfuck interpreter, as it would make my post huge, but it’s here (note, this doens’t actually show what APL can do, and makes it look like a procedural language.)

because APL Uses it’s own Character set you may need Apl385-Unicode font to actually read some of the code. that can be grabbed from the download area on http://www.dyalog.com

In the mean-time, here’s a quick screenshot of Brainfuck in APL in action:

apl1

And in the interest of saving some arguments, some will point out that ⎕←’Hello World!’ is _NOT_ Hello world in APL – I used this to show the same output – as interpreted, this is ok, as a program, I agree. it isn’t. – also note that I shortened the function name to “bf” just because that was easier to type :-)

Who knows. Maybe the “bf” function will be included in Dyalog. just for a little bit of fun. Well, it is, isn’t it! :-)

Jay.