Page namespace (page_namespace) | 0 |
Page title (without namespace) (page_title) | 'Defunc' |
Full page title (page_prefixedtitle) | 'Defunc' |
Old content model (old_content_model) | 'wikitext' |
New content model (new_content_model) | 'wikitext' |
Old page wikitext, before the edit (old_wikitext) | ''''Defunc''' is a [[:Category:Functional_paradigm|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:
{| class="wikitable plainpres"
|-
! Function !! Description
|-
| <code>0</code> || Returns a 0
|-
| <code>+a</code> || Returns a+1
|-
| <code>?abcd</code> || If a>b, return c, otherwise return d
|-
| <code>.a</code> || Writes a to the console, while returning it (Note: Defunc will output the actual integer and does not support ASCII)
|-
| <code>,</code> || Requests user input in the form of an integer
|}
Every function only evaluates the necessary arguments, meaning that <code>?abcd</code> will evaluate a, b, and one out of c and d. This also includes writing to the console. <code>?0.a0b</code> 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: <code>>ab?abab</code> defines a <code>></code> function with variables <code>a</code> and <code>b</code> 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 <code>Sabi?biS+ab+ia,</code> which increments a and the counter variable i, until i reaches b. Then it returns a, which by then had b increments applied to it. Usually in execution, a 0 should take the place of i, to assure a complete addition. Note that these functions will automatically query all <code>,</code> even if they will not be used.
==Other Syntax==
Anything must return exactly one argument. <code>Iaa</code> is valid, as <code>Ia</code> returns <code>a</code>, but <code>Iaaa</code> is not, as it would imply <code>Ia</code> returns <code>aa</code>, 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.
==Examples==
===[[Hello, world!]]===
4a++++a
Ba44444444a
LBBB4440
.+4444444.BB440
..L
.+++L
.+++44444BB.B0
.+++.+++L
.L
.BBB40
.+B0
Due to output restrictions this will only output the decimal form of the ASCII codes
===[[Cat program|Cat]]===
C?0.,0C
C
The input is restricted to an integer
===[[Fibonacci sequence]]===
Sabc?bcS+ab+ca
Fab?0.a0FbSab0
F0+0
===[[Factorial]]===
Arci?ciA+rc+ir
*ab?b0Aa*aA0b+000
!a?a1*a!A0a11
!,
===[[Ackermann function]]===
-ab?a+b-a+bb
Aab?a0?b0A-a0Aa-b0A-a0+0+b
A,,
===[[Truth-machine]]===
Ta?.a0Ta0
T,
==External resources==
* [https://github.com/Ob3vious/Esolang_defunc Official interpreter]
[[Category:Languages]]
[[Category:Functional_paradigm]]
[[Category:2021]]
[[Category:Unknown computational class]]' |
New page wikitext, after the edit (new_wikitext) | ''''Defunc''' is a [[:Category:Functional_paradigm|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:
{| class="wikitable plainpres"
|-
! Function !! Description
|-
| <code>0</code> || Returns a 0
|-
| <code>+a</code> || Returns a+1
|-
| <code>?abcd</code> || If a>b, return c, otherwise return d
|-
| <code>.a</code> || Writes a to the console, while returning it (Note: Defunc will output the actual integer and does not support ASCII)
|-
| <code>,</code> || Requests user input in the form of an integer
|}
Every function only evaluates the necessary arguments, meaning that <code>?abcd</code> will evaluate a, b, and one out of c and d. This also includes writing to the console. <code>?0.a0b</code> 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: <code>>ab?abab</code> defines a <code>></code> function with variables <code>a</code> and <code>b</code> 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 <code>Sabi?biS+ab+ia,</code> which increments a and the counter variable i, until i reaches b. Then it returns a, which by then had b increments applied to it. Usually in execution, a 0 should take the place of i, to assure a complete addition. Note that these functions will automatically query all <code>,</code> even if they will not be used.
==Other Syntax==
Anything must return exactly one argument. <code>Iaa</code> is valid, as <code>Ia</code> returns <code>a</code>, but <code>Iaaa</code> is not, as it would imply <code>Ia</code> returns <code>aa</code>, 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.
==Examples==
===[[Hello, world!]]===
4a++++a
Ba44444444a
LBBB4440
.+4444444.BB440
..L
.+++L
.+++44444BB.B0
.+++.+++L
.L
.BBB40
.+B0
Due to output restrictions this will only output the decimal form of the ASCII codes
===[[Cat program|Cat]]===
C?0.,0C
C
The input is restricted to an integer
===[[Fibonacci sequence]]===
Sabc?bcS+ab+ca
Fab?0.a0FbSab0
F0+0
===[[Factorial]]===
Arci?ciA+rc+ir
*ab?b0Aa*aA0b+000
!a?a+0*a!A0a+0+0
.!,
===[[Ackermann function]]===
-ab?a+b-a+bb
Aab?a0?b0A-a0Aa-b0A-a0+0+b
.A,,
===[[Truth-machine]]===
Ta?.a0Ta0
T,
==External resources==
* [https://github.com/Ob3vious/Esolang_defunc Official interpreter]
[[Category:Languages]]
[[Category:Functional_paradigm]]
[[Category:2021]]
[[Category:Unknown computational class]]' |
Unified diff of changes made by edit (edit_diff) | '@@ -58,11 +58,11 @@
Arci?ciA+rc+ir
*ab?b0Aa*aA0b+000
- !a?a1*a!A0a11
- !,
+ !a?a+0*a!A0a+0+0
+ .!,
===[[Ackermann function]]===
-ab?a+b-a+bb
Aab?a0?b0A-a0Aa-b0A-a0+0+b
- A,,
+ .A,,
===[[Truth-machine]]===
' |