# Fargo

**Fargo** (**F**unction **arg**ument-**o**) is an esolang created by User:PythonshellDebugwindow.

## Overview

Fargo is a functional esolang. Each line is either a function definition, a function call, a blank line, or a comment.

## Memory

Fargo uses an input number, an integer which is defined by the interpreter (typically to be a user-input number) before the program begins. It also uses an output number, which can be output at any time in the program.

## Syntax

### Function calls

A function can be called by typing its name followed by a space, then its (space-separated) arguments, which are evaluated from left to right.

### Function definitions

Function definitions are rather unorthodox in Fargo. Each definition takes up exactly one line (excluding comments). The first token of a function definition is its name (redefining an existent function is an error); the rest of the tokens are its arguments and its code. The divide between arguments and code is fairly unusual: the first defined name is the first code token, and the previous token is the final argument. Defined names are built-in functions, user-defined functions (including the function being defined), and the arguments of the function currently being defined.

Functions must contain exactly one outer function call (e.g., `myFn x y z otherFn x thirdFn y z`

is legal while `myFn x y z otherFn x y z anotherFn x`

and `myFn`

are not; even though the first example calls `thirdFn`

, it doesn't do so at the top level).

### Colons

If a token begins with a `:`

colon, it either represents a raw function (as opposed to a function call), which can be used as an argument to a function, if it is not a function argument; or marks a function argument as being a raw function, rather than a value.

### Literals

Literals are binary integers matching the regex `/[0-1]+/`.

### Comments

Comments are declared by using `#`

, and last until the end of the line.

## Built-in functions

`<`

returns*x**x*right-shifted by 1`>`

returns*x**x*left-shifted by 1`&`

returns*x**y**x*bitwise-AND*y*`|`

returns*x**y**x*bitwise-OR*y*`^`

returns*x**y**x*bitwise-XOR*y*`[]`

returns an array with only*x**x*in it`+[]`

returns the array*x**y**x*concatenated with the array*y*`[?]`

returns the*x**y**y*th element of the array*x*`@`

returns the*x**x*th bit of the input number (LSB = 0th bit)`%`

sets the*x**y**x*th bit of the output number to*y*(LSB = 0th bit)`$`

outputs the output number in base-10`:`

does*x**y**y*iff*x*is unequal to zero

## Examples

### Truth-machine

one & $ one % 0 @ 0 : @ 0 one