We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.
FAR
- Not to be confused with Far.
FAR (Float ARray) is a stack-based array-based programming language where you can only interact with floating point number arrays.
Memory layout
FAR has both a stack and a "buffer". Anything produced by an instruction is put in the buffer unless stated otherwise, and any array you write too. You can (and should) push array to the stack, as the buffer gets overwritten with every new value that must be put there.
Syntax
In FAR, any sequence of numbers is understood as an array to be put in the buffer. For example:
1 2 3
Produces an array containing those three numbers.
These can, of course, contain a minus and/or a dot like so:
1 3.5 .4 -3 -2.5 -.9
Instructions
Instructions must be space-separated from both numbers and other instructions. This is clearly NOT because User:UbiSum doesn't know how to make a better parser, don't be silly.
Instructions try using the buffer first, and only resort to using the stack if it's None. Those that use or consume two arrays will do the same only for the first array, the second will be taken from the stack.
Important: When reading from STDIN, FAR converts any string representation of a number to float. If you want to read inputted numbers as their characters instead, prepend them with a backslash (like "\10" instead of "10"), it won't be read.
| Character | Action |
|---|---|
| " | Comment |
| ; | Push buffer to stack |
| : | Duplicate and push to stack |
| ~ | Clean buffer |
| @ | Pop stack into the buffer |
| x | Swap two arrays |
| , | Get input without spaces |
| % | Get input with spaces |
| . | Pop and print as numbers |
| $ | Pop and print as UTF-8 characters |
| + | Add |
| - | Subtract |
| * | Multiply |
| / | Divide |
| ^ | Raise to the power of |
| \ | Remainder |
| = | Filter first array's elements, retain those equal to any of the second one's |
| < | Filter first array's elements, retain those smaller than all of the second one's |
| > | Filter first array's elements, retain those bigger than all of the second one's |
| & | Concatenate |
| # | Replace the second array's elements with the first's |
| Get the last element and discard the rest | |
| o | Round all elements |
| r | Reverse the array |
| ? | If true (array has elements) |
| ! | If false (array is empty or doesn't exist) |
| _ | Endif (doesn't do anything) |
| ( and [ | Save position to loop back to |
| ) | Loop if true |
| ] | Loop if false |
| ` | Halt |
REPL-specific commands
| Command | Action |
|---|---|
| #quit, #q | Quit REPL |
| #stats, #s | Print current the state of both the stack and the buffer |
| #clear, #cls, #c | Clear screen |
| #reset, #r | Reset stack and buffer |
Examples
"Hello, world!":
72 101 108 108 111 44 32 119 111 114 108 100 33 $
Cat:
% $ " with spaces , $ " without spaces % . " with spaces, UTF-8 codes , . " without spaces, UTF-8 codes
Turing machine that prints `NO` if input is neither 1 or 0:
, r | ; : 0 = ? . ` _ ~ : 1 = ! 78 79 $ ` _ ( . 1 )
Nth number in the Fibbonacci series:
, r | ; 0 1 ; ( x 1 > ; ! x r | . ` _ 1 - x : | ; 0 & + r ; ) @ ~