top | item 46419501

(no title)

boerseth | 2 months ago

> Brainf*ck is the antithesis of modern software engineering. There are no comments, no meaningful variable names, and no structure

That's not true. From the little time I've spent trying to read and write some simple programs in BF, I recall good examples being pretty legible.

In fact, because the language only relies on those few characters, anything else you type becomes a comment. Linebreaks, whitespace, alphanumeric characters and so on, they just get ignored by the interpreter.

Have a look at this, as an example: https://brainfuck.org/chessboard.b

discuss

order

librasteve|2 months ago

I also wonder whether brainfuck (ie turing machine like) coding would be a more efficient interface to LLMs

For those who want to try it, there’s always the https://raku.org module…

  use Polyglot::Brainfuck;
    
    bf hi { 
        ++++++++[>++++[>++>+++>+++>+<<<<-]>
        +>+>->>+[<]<-]>>.>---.+++++++..+++.
        >>.<-.<.+++.------.--------.>>+.>++. 
    }
    
    say hi.decode; # Hello World!
    
    bf plus-two {
        ,++.
    }
    
    say plus-two(buf8.new: 40).head; # 42

tgv|2 months ago

To me, that's still unreadable. While the intention of the code may be documented, it's pretty hard to understand if that "+" is really correct, or if that "<" should actually be a ">". I can't even understand if a comment starts or terminates a particular piece of code.

BTW, how come there are dashes in the comment?

tromp|2 months ago

The initial long comment starts with the [ command and ends with the ] command so it forms a loop that is executed while the current cell is nonzero. But initially, all tape cells are zero, so the whole loop is in fact skipped.

Readability is a spectrum. The brainfuck code is still somewhat readable compared to for instance this Binary Lambda Calculus program:

00010001100110010100011010000000010110000010010001010111110111101001000110100001110011010000000000101101110011100111111101111000000001111100110111000000101100000110110

or even the lambda term λ(λ1(1((λ11)(λλλ1(λλ1)((λ441((λ11)(λ2(11))))(λλλλ13(2(64)))))(λλλ4(13)))))(λλ1(λλ2)2) it encodes.

btreecat|2 months ago

> That's not true. From the little time I've spent trying to read and write some simple programs in BF, I recall good examples being pretty legible.

Anything in a reasonably familiar type face and size will continue to be legible, however brainfuck is not easily human parsable.

Greatly reducing its ability to be _read and mentally internalized._ With out that, are you really doing software engineering or are you actually a software maintenance person?

A janitor doesn't need to understand how energy generation works if he has to change the light bulb.