Here is a listing of all built-in subprograms in the Mint libraries.|
The operator library provides common operators such as +, -, *, / in subprogram format.
Returns the bitwise NOT of a. This is the same as
Returns negative a.
Returns the bitwise AND of a and b. This is the same as
Returns the bitwise OR of a and b. This is the same as
Returns the bitwise XOR of a and b. This is the same as
Returns a to the power of b.
Takes the integer a and shifts it b bits to the left. This is the same as
Takes the integer a and shifts it b bits to the right. This is the same as
Takes the integer a and shifts it b bits to the right. The old most significant bit is copied into the new most significant bit. This is the same as
Returns a times b.
Returns a divided by b.
Performs division between a and b, rounding down to the nearest whole number.
Returns true only if a and b are both true. Otherwise, returns false.
Returns true if a or b is true. Otherwise, returns false.
Returns true if either a or b is true, but not both. Otherwise, returns false.
Returns true if a is false, and false if a is true.
Returns true if a equals b.
Returns true if a is not equal to b.
Returns true if a is greater than b.
Returns true if a is less than b.
Returns true if a is greater than or equal to b.
Returns true if a is less than or equal to b.
The math library provides mathematical constants and math subprograms.
An approximation of the base of the natural logarithm. It is a constant equal to 2.7182818284590452354.
An approximation of the ratio between a circle's circumference and diameter. It is a constant equal to 3.14159265358979323846.
An approximation of the golden ratio. It is equal to half of 1 plus the square root of 5 or 1.618033988749895.
A Mint object that is bigger than any number.
A Mint object that is more negative than any number.
A number that is not defined.
Attempts to solve the equation defined by functor, which should
be a subprogram such as:
sub f(x) return x^2 + 2(x) - 9 endIt will find when a function
It will start guessing for x by setting
Takes the derivative of the subprogram f,
such that the returned subprogram fPrime,
written as f'(x), is f differentiated with respect to x.
In other words, differentiating the subprogram
that implements the math function g(t) = ln(t) + t3
will return a Mint subprogram called gPrime that
implements the math function g'(t) = 1/t + 3(t2)
Performs the math operation
using the fastest known calculation method.
Returns the absolute value of a.
Returns the sine of a radians.
Returns the cosine of a radians.
Returns the tangent of a radians.
Returns the arcsine of a.
Returns the arccosine of a.
Returns the arctangent of a.
Returns the hyperbolic sine of a.
Returns the hyperbolic cosine of a.
Returns the hyperbolic tangent of a.
Returns the hyperbolic arcsine of a.
Returns the hyperbolic arccosine of a.
Returns the hyperbolic arctangent of a.
Returns the natural log of a.
Returns the log base 10 of a.
Returns the square root of a.
Returns the cube root of a.
Returns a!, where ! means factorial.
Returns the log base b of a.
Returns a if a is less than b. Otherwise, returns b.
Returns a if a is greater than b. Otherwise, returns b.
Constructs a big integer object from a. a can be a real number, an integer, or string. Big integers can hold extremely large numbers.
For example, try:
import math print factorial(BigInt(500))
Constructs a precise real object from a. a can be a real number, an integer, or string. Precise reals offer more precision than regular real numbers.
import math print 1 / 3 print PreciseReal(1) / PreciseReal(3)Library type
The type library offers subprograms that convert between the different variable types of Mint.
Converts a into a string.
Converts a into an integer.
Converts a into a real number.
Converts a into a truth value, either true or false.
Returns the type of object a as a string.
Converts a into a list.
Converts the integer a into an ASCII character.
The time library offers subprograms that measure or deal with time.
Causes the program to wait for a milliseconds.
Returns the current year.
Returns the string "am" if it is before noon, and "pm" otherwise.
Returns a string that represents the current date.
Returns the current hour in 12-hour format.
Returns the current hour in 24-hour format.
Returns the current millisecond.
Returns the current minute.
Returns the current month as a number between 1 and 12.
Returns the current second.
Returns the current timezone as a string.
Returns the current weekday as a string.
Returns the current weekday, where 0 is Sunday and 6 is Saturday.
The system library offers subprograms that deal with system functions and low-level assembly-like commands.
Exits the Mint program.
Exits the Mint program with exit code 1, which indicates some form of error has occurred.
Returns the command line arguments passed to the program as a list of strings.
Returns [w, t]. If t and w are real numbers (numbers with decimal points in them), this will also perform
Scans the system, returning some information about
the Mint Virtual Machine's memory usage.
Returns the size of a Mint object in bytes.
An integer is worth 4 bytes, a real number takes up 8 bytes,
and a fraction takes up a massive 16 bytes.
Strings and lists have different lengths and will vary in size.
The size of
Values that are represented with less than 8 bits
will return a real number, such as 0.5 for a 4-bit integer.
Attempts to clear the screen of text characters.
This will try to call the Windows
If that does not work, it will display a bunch of empty
lines to clear the screen.
Takes any Mint value, such as a string
or a table, and returns the address where it is
located in memory.
Takes any Mint value, such as a string
or a table, and returns the ID number of the
data segment where it is located in memory.
Performs the C and C++ operation
will deference the pointer with address
Modifies the string at address
In C++, this is equivalent to:
string *somePointer = addr; somePointer = newString;Note that the data segment ID number is
to ignore all errors. Instead of errors crashing the program,
ignored errors are saved in the file:
Returns a table of all strings, with the addresses
of the strings as the keys.
Returns a table that represents
the entire Mint Virtual Machine.
The compression library offers subprograms that will put multiple files together into a single file.
If listOfFiles is a list of strings such as
will glue together the contents of those files, and save the result as outputFile.
Opening the glued file in a hex editor will allow you to see all the files in that glue file,
separated by a randomly generated separator.
It is suggested that outputFile end with the file extension: .glue
Note that gluing files together does not preserve the filenames of each file.
Also, there is currently no
The file library offers subprograms that modify files and folders.
Creates a bytes object out of a, where a is a list of integers or a string.
Appends the string s to the file with name fileName.
Converts a bytes object to a string of hexadecimal digits.
Returns true if it is possible to read and write to the file with name fileName.
Copies file1 to file2.
Deletes file or folder f.
Returns true if file or folder f exists.
Converts a file's contents into a string.
Converts a full path to a relative path, relative to the program's path.
Gets the folder name of the folder the program is in.
Gets the size of file fileName.
Returns a list of filenames in the folder folderName.
Converts a hexadecimal string of digits into a bytes object.
Creates the folder folder.
Reads a bytes object from file, where the bytes begin at position begin and end at position end.
Reads a hexadecimal string of digits from file, where the hex begins at position begin and ends and position end.
Returns fileName, but with the file extension removed.
Writes the string s to file fileName.
Writes bytes to the file fileName starting at position begin.
Writes a hexadecimal string of digits to the file fileName starting at position begin.
The web library offers subprograms that interface with the Internet.
Gets the HTML contents of the website url.
Downloads a file from url to file fileName.
Sets up an IRC bot on server server, with name botName, on a list of channels channels, with a debugging mode showDebug, and a subprogram commandsSub that will be executed whenever the bot receives a message. commandsSub takes five arguments, all of which are strings, which are channel, sender, login, hostname, and message.
This subprogram can only be used inside your commands subprogram for connectToIRC. It sends the string msg to the channel channel, thereby chatting on IRC.
This subprogram can only be used inside your commands subprogram for connectToIRC. It sends the string msg to the channel channel, but performs no modifications to the string. This is used to execute IRC commands.
Unfortunately, it is not currently possible to control the channel on which the message displays. For example:
import web import time import system sub commands(one, two, three, four, five) sendMessage("#some_channel", "hi") //Says hi on #some_channel. sendRawLine("NICK Eugene") //Changes the bot's nickname to Eugene. end connectToIRC("irc.SOME_EXAMPLE_SERVER.net", "SomeBot", ["#some_channel"], true, commands)
Opens a web browser page that points to url.
Gets the IP address of the computer.
The mint library offers subprograms that interface with the Mint interpreter.
Evaluates the expression s and returns the resulting value.
Executes the string s as a Mint program.
The graphics library offers subprograms that draw graphics to the screen.
Creates a window object.
Shows a message box with a title and message.
Shows a warning box with a title and message.
Shows a error box with a title and message.
Shows a plain message box with a title and message.
Shows a question box with a title and message. If the selected option is yes, returns true. If the selected option is no, returns false.
Creates a button object, which can be added to a window.
Creates an arc object which can be drawn onto a window.
Creates an line object which can be drawn onto a window.
Creates an oval object which can be drawn onto a window.
Creates an polygon object consisting of the points (x, y), (x2, y2), (x3, y3), etc. which can be drawn onto a window.
Creates an rectangle object which can be drawn onto a window.
The thread library offers subprograms that give multi-threading capabilities.
Runs the subprogram t with no arguments as a single thread. Multiple threads run side-by-side in a single Mint program.
The random library generates random numbers.
Using coinToss(0.5) will toss a fair coin, with a 50%
chance of returning "heads" or "tails".
coinToss(1.0) will always return heads.
coinToss(0.0) will always return tails.
coinToss(0.75) will return heads 75% of the time.
coinToss(0.2) will return tails 80% of the time.
Returns a random integer that is greater than or equal to a and less than or equal to b.
Returns a random real number between 0.0 and 1.0, not including 1.0.
Returns a 32-bit random integer, calculated by grabbing various data from the Internet.
You must be connected to the Internet for this to work.
Returns a random real number between 0.0 and 1.0, not including 1.0, calculated by grabbing various data from the Internet.
You must be connected to the Internet for this to work.
The programming library allows you to run programs in other coding languages that are not Mint.
Runs a Python program. You must have Python installed.
Runs a Java program. You must have Java installed.
You might need to run
time is to compile the .java file, and the second time is to
run the compiled results.
The "data.mint" library defines some data structures that aren't inherently built-in to Mint.
Generates a tree node which can have any number of children. r is the value associated with the node.
Generates an empty set where order of elements is unimportant. Sets only care about unique elements. If an object is already in the set, it cannot be re-added to the set.
Generates an empty sorted list. A sorted list keeps its elements in order as they are added to the list.
Uses the Bubble Sort algorithm to sort the list lst. The sorted result is returned.
Uses the Quick Sort algorithm to sort the list lst. The sorted result is returned.
Previous Lesson: Operator Overloading
Next Lesson: Object Methods
Table of Contents