Left-or-right

From Esolang
Jump to navigation Jump to search

Left-or-right is a very simple language xnor made up. Its expression are made of arrows < (left), > (right), and parentheses.

An expression A<B picks the left item A, while A>B picks the right one B.

Take, for example, ><>. The operator in the middle is <, and, confusingly, the items on each side A and B are also arrows. Since the operator tells us to take the left one A, which is >. So, ><> equals >.

Expressions also nest. We can replace the expression with its value. So, for example, (><>)<< equals ><< equals >. And, >(><>)< equals >>< equals <. For another example, (><>)(<<<)(>><) equals ><< equals >.

Instruction List

Instruction What it does
A<B Return A, the left argument.
A>B Return B, the right argument
> If > is by itself, lazily return the value.
< If < is by itself, lazily return the value.
(...) Group ... to have a special precedence