From Esolang
Jump to navigation Jump to search

Rhotor is an esoteric programming language developed by Jannis Harder in 2006.

Rhotor is a lazy evaluating functional programming language that utilizes pattern matching.

Data types

Rhotor has 3 data types:

Functions have a matching pattern (the function head), the function code (the function body) and an optional failure function (the function footer)
Nil is the only constant in Rhotor.
A cons concatenates two other items. It can be used to build lists or tree structures. As there are no numbers or strings in Rhotor you have to use Cons and Nil to represent them.

Language syntax

Operators with the highest precedence are listed first.

< >
Those signs act as parentheses. Empty parentheses evaluate to Nil.
head/body or head/body\footer
This syntax is used for functions. Functions are right associative. (a/b/c is the same as a/<b/c>). Wrap functions that use the Footer in parentheses.
This is the syntax for concatenation (Cons). Concatenation is right associative.
function argument or function.argument
This is the syntax for application. It applies function to argument. Application is left associative.
lowercase word
A lowercase word acts as a symbol. Symbols can be defined in a function head and are valid in the body. If you want to redefine a symbol you have to use the :symbol notation.
:lowercase word
This redefines a symbol and can only be used in a function head.

Spaces, uppercase letters and periods are equivalent and can be used to separate symbols and comment the code.

Pattern matching

A pattern is build using Nil, cons and symbols. A pattern matches a function if all elements, except symbols, are equal. Symbols act as a wildcard and match anything.

Application rules

  • Nil argument always evaluates to Nil.
  • a,b argument evaluates to <a argument>,<b argument>.
  • function matching-argument evaluates to the body of the function where every symbol in the body is replaced with the value the same symbol in the pattern matched. Symbols that doesn't occur in the pattern aren't replaced.
  • footerless-function non-matching-argument evaluates to Nil.
  • function non-matching-argument evaluates to function-footer argument.

Data representation

Rhotor specifies data representations for natural numbers and strings. They are not part of the language but of the IO system.


Numbers are written as <> followed by N times ,<>. There is a short cut notation %N.


Strings are written as <byte1>,<byte2>...<byteN>. Again, there is a short cut notation %"String". You may use \n for a newline and \" for a quote character.

IO system

The program is applied to the user input and the evaluated string is printed to the screen.

Turing completeness proof

Using the following rules, it is possible to transform any lambda calculus expression into an equivalent Rhotor expression.

  1. Replace every ( and ) with < and >.
  2. Replace every λ a . b with :a/b

External resources