We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.
Absolute Infinity
Jump to navigation
Jump to search
- This article has nothing to do with googology.
Absolute Infinity is a programming language designed by PSTF. It's opened for every users for adding commands.
Rules
- Do not add non-computable commands, such as a command that can directly solve the halting problem.
- You can add commands that manipulate the system, but do not add commands that will definitely crash the system.
- Do not add joke commands.
- You can add commands that duplicate existing functionality (as long as they are not exactly the same), but do not add commands that have the same name as an existing command but are completely unrelated to its function.
- You can add commands like API calls, but these APIs must connect to already implemented languages such as Python, Lua, or C++. You can also add self-evaluation and self-programming commands.
- All data is stored in variables, but you can manipulate memory and add common data storage models (as long as you don't add them to the language's built-in storage, anything goes—especially stacks, queues, and deques) or add commands that simulate these data models.
- Do not add any form of memes (especially bad ones) to commands or command descriptions.
- You can add prefixes, operators, and keywords, but if not specified, all commands are considered functions.
Reserved Area
Except for the development team leader, deputy leader, and developers at levels 6 to 8, no one is allowed to add, change, or delete anything in the reserved area.
- Comments start with
[[!?and end with?]]. - Strings are enclosed in single or double quotes. Multi-line strings (documents) are enclosed in triple or six quotes.
- Escape sequences are the same as in Python.
- Lists are enclosed in square brackets and separated by commas, working similarly to Python. Decimal indexes are allowed (if you encounter a decimal, just round it down). The index starts at 0.
Data Literals
- Integer
- A string made up of digits (any of 0-9) is called an integer. Leading zeros and underscores as separators are allowed, although this is pretty counterintuitive, because usually in writing commas are used as separators (or dots in some Western European countries), but Python uses underscores. Prefixes like 0k, 0v, 0x, 0o, 0p, 0t, 1t, and 0b are allowed, representing base 36, base 20, base 16, base 8, base 5, base 3, balanced base 3, and base 2, respectively. Bases higher than 36 are enclosed in double curly braces, followed by the decimal base indicated, for example, {{x}}64 means x is a number sequence in base 64.
- Decimal
- A decimal is a sequence of two numbers separated by a decimal point. It supports infinite precision decimals (which might require some special techniques in an interpreter or compiler to achieve, for example using Python dictionaries to represent the position in base 10 by converting the integer to a string, like 0 for units place, 1 for tens place, 2 for hundreds place, -1 for tenths, etc.) and even repeating decimals (which require even more special techniques to handle, so implementing this in a programming language can be very hard, but it's not impossible).
- String
- See the second item above.
- Boolean values
- there are only two literals, true and false. When actually using them, you need to capitalize the first letter (just like in Python).
- Nil
- Just nil, nothing else.
- Key-value pair
- A key-value pair consists of an identifier and a value, in the format
id: value. A list that stores key-value pairs is called a dictionary, and you can access elements by their keys instead of their index numbers. - Ordered pair
- A pair of elements written in the form (1st, 2nd) is called an ordered pair, where we call 1st the first value and 2nd the second value.
- Complex numbers
- a number in the form a + bi, where a is called the real part and b is called the imaginary part. Taking its absolute value gives the distance from the point on the coordinate plane (with the real part as the x-coordinate and the imaginary part as the y-coordinate) to the origin. For example, the absolute value of 1 + 1i is the square root of 2. You can't compare their size because ℂ (the set of Complex numbers) isn't ordered. Complex numbers with a zero imaginary part automatically become real numbers.
- List
- See above.
- Dictionary
- See above.
Operators
- +
- If both operands are numbers, return their sum. If both operands are complex numbers, let the first operand be a + bi and the second operand be c + di, and return the result of (a + c) + (b + d)i. If both operands are iterable objects like lists or strings, append the second one to the end of the first.
- -
- If both operands are numbers, return their difference. If both operands are complex numbers, let the first operand be a + bi and the second operand be c + di, and return the result of (a - c) + (b - d)i. If both operands are lists, take their set difference (elements that does not exist in the second list). If the first operand is an iterable and the second operand is a numeric expression, split the iterable at the result of the expression. If there's only one operand, negate it—if it's a number, take its opposite; if it's a boolean, take the logical NOT; if it's an iterable, reverse the order.
- *
- If both operands are real numbers, return their product. If both operands are complex numbers, let the first operand be a + bi and the second be c + di, then return (ac - bd) + (bc - ad)i. If the first operand is an iterable, check the second operand: if it's a number, return the iterable repeated that many times (fractions are allowed, but the denominator must be a factor of the list length). If it’s also an iterable, return a list of starting indexes where the second operand appears in the first (or an empty list if it doesn't appear). If the second operand is a pair of numbers, both strings, replace occurrences of the first with the second one by one from start to end (ending when the first value no longer appears). If both operands are functions, apply then compositedly, for example, (f * g)(*args) means f(g(*args)).
- /
- If both operands are real numbers, return the result of their division. If both operands are complex numbers, let the first be a + bi and the second be c + di, and return .
- //
- If both operands are numbers (they must be integers!), return their quotient.
- %
- If both operands are numbers, return their remainder. If the first operand is a string and the second operand is a list, check all elements in the string that start with %, and replace them with elements from the list (same rules as C++). The second function of this operator only works in the Beta version; in the Alpha version, it is replaced by f-strings.
- &
- If both operands are booleans, return the result of their logical AND. If both operands are numbers, return the result of their bitwise AND. If both operands are lists, return their intersection.
- |
- If both operands are booleans, return the result of their logical OR. If both operands are numbers, return the result of their bitwise OR. If both operands are lists, return their union.
- `
- If both operands are booleans, return the result of their logical XOR. If both operands are numbers, return the result of their bitwise XOR. If both operands are lists, return their unique elements.
- ^
- If both operands are numbers, let the first be a and the second be b, and return a to the power of b. If the first operand is a list and the second is a number, then return the effect of reshaping it; that is, if a is a list and b is a number, then a^b in this language is equivalent to bρa in APL.
- @
- If both operands are numbers (must be integers!), return their greatest common divisor (in the Alpha version, the 'greatest common measure' mode was added to the standard math library and is no longer kept for this operator).
- >>
- If both operators are numbers, let the first be a and the second be b, and return the result of a divided by 2 to the power of b (as a float, not a bitwise operation).
- <<
- If both operators are numbers, let the first be a and the second be b, and return the result of a multiplied by 2 to the power of b (as a float, not a bitwise operation).
- <-
- Assignment.
- =, !=, <=, >=, <, >
- Comparisons.
- #
- Ignore everything after it inline.
Core Features
Control Flows
if (condition) do
Code
elif (condition) do
Code
else do
Code
end
while (condition) do
Code
end
for iterator in iterable where condition do
Code
end
stop skip redo return X retry if condition halt
Function Definition
fn functionName(arg_list) -> Type do
Code
end
Recursion and enclosure is allowed, but I'm not showing them here.
I/O
input(__prompt) [[!? Raw input ?]] evalinput(__prompt) [[!? Evaluated input ?]] print(*args, sep <- " ", end <- "\n") [[!? Print ?]]
Logical Operations
and, or, not, xor
Error Handling
try do
DoSomething
catch Error as alias do
DoSomething
else do
DoSomething
finally do
DoSomething
end
Class
class YourClassName:
"""A simple example of OOP"""
# Attributes
fn __init__(this, *args, **kwargs) -> nil do
# Initialization
end
fn another_method(this, *args, **kwargs) -> type do
# Do something
end
end
class AnotherClassName(YourClassName):
"""Another simple example of OOP"""
# Attributes
fn __init__(this, *args, **kwargs) -> nil do
# Initialization
end
fn another_method(this, *args, **kwargs) -> type do
# Do something
end
fn overriding_method(this, *args, **kwargs) -> type do
# Do something more
end
end
class ThirdClassName(YourClassName, AnotherClassName):
"""More another simple example of OOP"""
# Attributes
# A class allows inheritance from multiple classes.
# If a method is defined in a parent class but not in the subclass,
# the method definition is searched from left to right
# in the first parent class.
fn __init__(this, *args, **kwargs) -> nil do
# Initialization
end
fn another_method(this, *args, **kwargs) -> type do
# Do something
end
fn overriding_method(this, *args, **kwargs) -> type do
# Do something more
end
fn overriding_2nd_method(this, *args, **kwargs) -> type do
# Do something even more
end
end
Λ-expression
lambda arg_list do something end
Type Conversion
type(x) typeof(x)
Quick iterable
range(a, b, c, head, tail) search(src, des, maxsearch) replace(src, des, mask, maxreplace) replaceregex(src, regexdes, mask, maxreplace)
Some built-in features by PSTF
nop No operation. length(x) Return the length of x where x is any iterable thing. map(x, f) Apply the function f to every element of x. x has to be an iterable, and f has to be a function reference. sort(x, comp) Sort x according to the specified comparison order. It won't change x, it will just return the sorted result. abs(x) If x is a number, return the absolute value of x. rotate(x, y) Rotate x by y positions (if y is positive, rotate left; if y is negative, rotate right), where x is an iterable and y is an integer.
Built-in Constants
infinity, NaN, nil, true, false
User Added Features
Add any commands here. Remember to add == By User:Example Username == before the collection of your features you added.
Examples
Add here.