Fourier

From Esolang
Jump to: navigation, search

Fourier is a golfing language created by Stack Exchange user Beta Decay, with similarities to Brainfuck, but more advanced. It is still undergoing development as of August 2015.

Syntax[edit]

Repeat[edit]

x()

Repeat the code within the brackets until the accumulator equals the value of the accumulator at x. After the open bracket, the accumulator is set to 0. Repeats can be nested.

If[edit]

x{a}{b}

If the result of a equals the value of the accumulator at x then run code b. After the open curly bracket, the accumulator is set to 0. Ifs cannot be nested.

Increase[edit]

^

Increase the accumulator by one.

Decrease[edit]

v

Decrease the accumulator by one.

Number[edit]

n

Set the accumulator to the integer n.

Character out[edit]

a

Takes the value of the accumulator as the ASCII code and outputs the character.

Number out[edit]

o

Outputs the value of the accumulator.

Random[edit]

r

Sets the accumulator to a random value in the range 0 to the value of the accumulator.

Set variable[edit]

~z

Creates a variable z and sets it to value of the accumulator.

Call variable[edit]

z

Sets the accumulator to the value of variable z. If not previously initialised, the variable is equal to 0.

Add[edit]

+x

Sets the accumulator to the value of the accumulator plus the value of x.

Subtract[edit]

-x

Sets the accumulator to the value of the accumulator minus the value of x.

Multiply[edit]

*x

Sets the accumulator to the value of the accumulator multiplied by the value of x.

Divide[edit]

/x

Sets the accumulator to the value of the accumulator divided by the value of x.

Modulo[edit]

%x

Sets the accumulator to the remainder of the value of the accumulator divided by the value of x.

Input[edit]

I

Sets the accumulator to the user input.

Greater than[edit]

>x

Sets the accumulator to 1 if the value of the accumulator is greater than the value of x, 0 if not.

Less than[edit]

<x

Sets the accumulator to 1 if the value of the accumulator is less than the value of x, 0 if not.

Equal to[edit]

=x

Sets the accumulator to 1 if the value of the accumulator is equal to the value of x, 0 if not.

Example[edit]

Ascii table[edit]

Code[edit]

33~j126(j^a~j)

Output[edit]

"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

Fibonacci sequence[edit]

Code[edit]

1~yI~k(xoi^<k{1}{44a32a}y+x~gy~xg~yi^~i)

Output[edit]

For input 30:

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229

Interpreter[edit]

Find the up to date Python interpreter here at CodePlex.