Apraxia

From Esolang
Jump to navigation Jump to search

Apraxia is a created by User:Yayimhere, after being disappointed by the use of the before mentioned term. In Apraxia, every string of length ≥1 is valid as code. Apraxia is quite complex compared to some other languages by yayimhere, as it allows recursive functions and variables, as well as null, and a fixed point combinator. All variables in Apraxia are both sub programs/strings, and functions. As such, Apraxia is semi-functionally pure(as all strings are represented by a function).

Etymology

Apraxia's name comes from the name of lisp, as both are speech difficulties. Lisp specifically was chosen as lisp is meme-ed over being full of brackets, or in other words, being very "pattern like".

Syntax

As mentioned before, Apraxia allows all strings of symbols. As such, syntax is very generalized. Note that the last character of the command is :

  • For any symbol X that is not recognized: All code between this symbol X and another non recognized symbol Y, is interpreted as the value of X as a variable.
  • For any two symbols M & N following each other, that are both recognized: This is function application of the form M(N). Note that for any length of function application, it is nested, so for the symbol set MNW it will be read as M(N(W)).
  • For any single symbol X that is recognized, but is not in a pair: Expand into its variable value.

Apraxia uses the ISO 8859-1 printable character space.

Semantics

First, there is the last character of the program, which is different from all others. The last character C has the function:

C(XYZ...) -> X(C(YZ...))
C() -> C

This is the before mentioned fixed point combinator, to some extent. As a variable value however, it is just the symbol C.

For all other variables X, their function is:

X(M) -> C(MX)

Then, when all variables and functions have been defined, we call the whole program as:

C(V1V2V3... Vn)

Where each V is one of the variables defined in the program, with V1 being the first defined, and Vn being the last. Then the whole program is evaluated. When evaluation has completed, the final result is printed.

Do note that the brackets used above are not actually present in the program in any way. As such, ( and ) are valid symbols in the program. Do also note that if a variable is given no value, it is though of as null, and it's function would be read as:

NUL(M) -> C(M)

Examples

Infinite Loop:

XCC

This is because:

XC -> X=C

And so it would be called as:

C(X)

Which expands and evaluates to:

C(C) -> C(C()) -> C(C)

As such, this is an infinite loop