Listfunc

From Esolang
Jump to navigation Jump to search

Listfunc, listfunk, or listpunc is an esoteric programming language created by User:CreeperBomb in 2023. Listfunc may be capitalised however* you want when it's in the middle of a sentence. Everything in listfunc is either a list or a func(tion). Listfunc is also very hard to read.

  • The two options are all lowercase and all uppercase

List & func

Lists are ordered and may contain any number of elements from none to infinitely many, although this upper "bound" is impossible to be reached without infinite program runtime. Lists begin with ( and end in ), and elements are do not have any spacing between them. All elements of a list are themselves lists. An example of a list (with lists inside) is (()()()(()())())

Functions are slightly more complicated. In the middle and end of a definition is a |. On the left, the names of the function and argument(s) are defined. On the right, the output is defined. The function name is defined in [] while the argument name is defined in {}. A definition will take effect if it matches the current situation, but if not then a later definition is used; in other words, previous definitions have higher priority and argument conditions may be used. Functions are applied with []. A succesor function might be defined as [()]({})|({}({}))|. TL;DR: [name]input(s)|output|.

In a way, Listfunc acts somewhat like a string-rewriting paradigm; outputs can be considered similar to replacements. Any undefined characters are ignored. Functions prefer to act on the least amount of stuff as possible, so []() when []{}|()| becomes ()() instead of (). Code is lazy evaluated, and the code after the last pipe is the code initially run.

I/O

The user may input by adding defined functions onto the beginning of the program state. If an argument on the right side is undefined on the left, then it should be user-inputted. The use sees the program state at all times, which is equivalent to output.

Turing completeness

Listfunc can simulate SKI calculus as follows:
S definition: [()()]({})({()})({()()})|{}({()()})({()}({()()}))|
K definition: []([])|[()]|[()]({})|[]|[]([()()])|[()()()]|[()()()]({})|[()()]|
It is known that I can be defined as S K K, which here would be written as [()()]([])([]). Not explicitly including it shortens the K definition.

Example programs

Successor function: [()]({})|({}({}))|
Decrement function: [()()]({}({}))|({})|