From Esolang
Jump to navigation Jump to search

Defunc is a function-based, minimalist esoteric programming language currently developed by User:Obvious. The language operates on functions that return integers. These functions can vary in input size. Its name comes from a portmanteau of "define" and "function"

Predefined functions

The language consists of 5 functions, which are as follows:

Function Description
0 Returns a 0
+a Returns a+1
?abcd If a>b, return c, otherwise return d
.a Writes a to the console, while returning it (Note: Defunc will output the actual integer and does not support ASCII)
, Requests user input in the form of an integer

Note that ?abcd will evaluate a, b, and only one out of c and d. This also includes writing to the console. ?0.a0b can therefore be used to write a and return b.

Other functions

Apart from the predefined functions, there are other functions as well. In a program you are able to define your own function, within the constraints of the programming language. To define a function, take a character that is not yet defined as a function or variable as the function name, then take any amount of characters that are not defined as a function for the variable names, and then give the function it should return. For example: >ab?abab defines a > function with variables a and b and outputs the greater.

Functions can refer to earlier functions, but also to themselves, to create a loop. You could for example write a sum function as Sabc?bcS+ab+ca, which increments a and the counter variable c, until c reaches b. Then it returns a, which by then had b increments applied to it. Note that this function is capable of subtracting as well as the function would return a+b-c if b is greater than c and would return a otherwise.

Other Syntax

Anything must return exactly one argument. Iaa is valid, as Ia returns a, but Iaaa is not, as it would imply Ia returns aa, which are two arguments and not one. You should use a line break to separate the definitions/calculations. Not everything has to be a definition. Executing a function has to be done as well.


Hello, world!


Due to output restrictions this will only output the decimal form of the ASCII codes



The input is restricted to an integer

Fibonacci sequence




Ackermann function




External resources