Skip to main content
5 of 10
Added some odd examples
Wheat Wizard
  • 100k
  • 22
  • 282
  • 661

#Brain-Flak

Factoid:

In Brain-Flak a one is shorter than zero and multiplying by seven takes more characters than multiplying by eight.

Since Brain-Flak programs must have an even number of characters I have added some programs with extra spaces for the odd length snippets. These are not well golfed intentionally but rather put there in an attempt to give you a little more for your kind upvotes.

###Length 2 snippet

<>

It switches to the offstack. As a single program this will always output nothing regardless of the inputs.

###Length 3 snippet

{ }

This is the {} nilad it pops top item on the stack and returns its value. As a full program it just removes the last item input.

###Length 4 snippet

(())

This program pushes one to the top of the stack. This is the shortest way to express 1 in Brain-Flak.

###Length 5 snippet

([ ])

This program pushes the stack height to the top of the stack. At the start of a program it acts like argc.

###Length 6 snippet

({}{})

This program adds two numbers.

It pops the top two elements and pushes the sum.

###Length 7 snippet

This one requires a -d flag to run so +3 bytes

(This one also doesn't work on try it online)

@ij 

This is the injection flag! (With a space after it because it needs to be length 7)

This halts the program takes a Brain-Flak program from STDIN and runs it as part of the code. Its my favorite flag and (arguably) Brain-Flak's shortest self interpreter. @ij flags can be nested

Wheat Wizard
  • 100k
  • 22
  • 282
  • 661