Overview


Standard classes

Object

Ancestor class for all other classes

Fields

None

Methods
object _get(this, string key)

May be null Not present, but can be defined in child class by user

Called when field in that object is accessed through object.field or Object.get.
When field is accessed through object["field"] call to this method will be omitted.

object _get_FIELDNAME(this)

May be null Not present, but can be defined in child class by user

Called when field FIELDNAME in that object is accessed through object.FIELDNAME or Object.get.
When field is accessed through object["FIELDNAME"] call to this method will be omitted.

object _set(this, string key, object value)

May be null Not present, but can be defined in child class by user

Called when field in that object is set through object.field = value or Object.set.
When field is set through object["field"] = value call to this method will be omitted.

object _set_FIELDNAME(this, object value)

May be null Not present, but can be defined in child class by user

Called when field FIELDNAME in that object is set through object.FIELDNAME = value or Object.set.
When field is accessed through object["FIELDNAME"] = value call to this method will be omitted.

dict table(this)

Get all key=value pairs in form of a dict

Number extends Object

Represents a number

Fields

None

Methods

None

Bool extends Object

Represents a boolean value

Fields

None

Methods

None

String extends Object

Represents a piece of text

Fields

None

Methods
string capitalized(this)

Makes first letter in string capital and all other letters - small

string centered(this, num size)

Centers string in row of defined size

list chars(this)

Returns list of characters of that string

num count(this, string needle)

Counts all occurrences of given needle in this string

string decoded64(this)

Returns base64 decoded version of that string (assuming that string is base64-encoded)

string encoded64(this)

Returns base64 encoded version of that string

bool endsWith(this, string suffix)

Checks if this string ends with given suffix

num find(this, string needle)

Returns index of first occurrence of needle in this string
If needle was not found, -1 is returned

num findFromRight(this, string needle)

Returns index of first occurrence of needle in this string, counting from rightmost char
If needle was not found, -1 is returned

string format(this, list values)

Format this string with given values by %number pattern.
E.g. "%0, %1".format(["Hello", 3]) -> "Hello, 3"

string inBetweenOf(this, list values)

Place this string in between given values.
E.g. ", ".inBetween(["a", "b", "c"]) -> "a, b, c"

bool isAlphaNumeric(this)

Check if string contains only numeric and alphabetical characters
Space is included

bool isAlphabetical(this)

Check if string contains only alphabetical characters
Space is included

bool isLower(this)

Check if string contains only lowercase letters

bool isNumeric(this)

Check if string contains only numeric characters

bool isUpper(this)

Check if string contains only uppercase letters

string lowerCased(this)

Returns same string, but with all characters being in lowercase

string replaceAll(this, string target, string replacement)

Does not mutate

Replaces all occurrences of target with replacement

string replaceFirst(this, string target, string replacement)

Does not mutate

Replaces first occurrence of target with replacement

string reversed(this)

Returns reversed string

num size(this)

Returns length of this string

list split(this, string delimiter)

Splits this string by given separator and returns that list

bool startsWith(this, string prefix)

Checks if this string starts with given prefix

string swappedCase(this)

Makes all uppercase letters lower and vice versa

string upperCased(this)

Returns same string, but with all characters being in uppercase

List extends Object

An ordered dynamic collection of various elements

Fields

None

Methods
void add(this, value)

Adds given value to the end

void addAll(this, list values)

Adds all given values to the end

void clear(this)

Clears the list

num count(this, needle)

Counts all occurrences of given needle in this list

num find(this, needle)

Returns index of first occurrence of needle in this list
If needle was not found, -1 is returned

num findFromRight(this, needle)

Returns index of first occurrence of needle in this list, counting from rightmost element
If needle was not found, -1 is returned

object get(this, num index)

Returns element at given index. If index is unrepresented, null is returned

void insert(this, num index, value)

Inserts given value at given index
After operation, value's located at index. All further elements are shifted by +1

string joined(this, string separator)
object pop(this)

Removes last element from list and returns the removed element

object remove(this, element)

Removes given element from list. Returns removed element

object removeElementAt(this, num index)

Removes element at given index from list. Returns removed element

void reverse(this)

Reverses this list

list reversed(this)

Does not mutate

Returns reversed list

object set(this, num index, value)

Sets element at given index.
If list's size < index, then list is expanded with null-s up to given index

num size(this)

Returns size of this list

void sort(this, func comparator)

Sorts the list with given comparator.
Comparator is a function which returns:

list sorted(this, func comparator)

Does not mutate

Acts like List::sort, but returns sorted list

Dict extends Object

A string key -> object value data structure

Fields

None

Methods
dict static assemblePairs(list pairs)
Static

Assemble dict from given list of [key, value] pairs

void clear(this)

Clears this dict

bool containsKey(this, string key)

Check if this dict contains given key

object get(this, string key)

Get value by given key in this dict

list keys(this)

List all keys in this dict

list pairs(this)

List all [key, value] pairs

void set(this, string key, value)

Set given key to given value in this dict

num size(this)

Returns size of this dict

list values(this)

List all values in this dict

Func extends Object

Resembles functions and methods

Fields

None

Methods

None

Null extends Object

Resembles the null value

Fields

None

Methods

None

Thread extends Object

An asynchronous thread

Fields

None

Methods
_constructor(this, func f, list args)

Create a thread with specific function and save arguments

object getResult(this)

Returns the value that function returned
If function is not over yet, returns null

bool isAlive(this)

Check whether the thread is alive or not

void start(this)

Starts execution of the function with defined arguments
Thread ends when function ends

void stop(this)

Stops the thread

object waitForResult(this)

Hangs while thread is alive and returns
the value that function will return


Standard exceptions

Exception

Base class for all exceptions in Quail

Fields
Methods

None

AssertionException extends Exception

Thrown when assert results in false

Fields

None

Methods

None

CircularDependencyException extends Exception

Thrown when one file is used in other file, that the first one trying to use

Fields

None

Methods

None

DerivationException extends Exception

Thrown on attempt to derive or extend from non-prototype object

Fields
Methods

None

IOException extends Exception

Resembles Java's IOException

Fields

None

Methods

None

IterationNotStartedException extends Exception

Thrown when _next() is called, but iteration was not started

Fields

None

Methods

None

IterationStopException extends Exception

Should be thrown when iteration reaches its end

Fields

None

Methods

None

UnsuitableTypeException extends Exception

Thrown when object is not suitable for operation because of its type

Fields
Methods

None

UnsuitableValueException extends Exception

Thrown when object is not suitable for operation because of its value

Fields
Methods

None

UnsupportedConversionException extends Exception

Thrown when object is not suitable for conversion

Fields
Methods

None

UnsupportedIterationException extends Exception

Thrown when object is not suitable for iteration

Fields
Methods

None

UnsupportedOperationException extends Exception

Thrown when an operation is not supported by object

Fields
Methods

None

UnsupportedStepSubscriptException extends Exception

Thrown when object is not suitable for stepped subscript

Fields
Methods

None

UnsupportedSubscriptException extends Exception

Thrown when object is not suitable for subscript

Fields
Methods

None

UnsupportedUnaryOperationException extends Exception

Thrown when an operation is not supported by object

Fields
Methods

None

IndexOutOfBoundsException extends Exception

Thrown when indexing is out of bounds

Fields
Methods

None

ClarificationException extends Exception

Thrown when clarified variable is assigned to unsupported value

Fields
Methods

None

ArgumentClarificationException extends Exception

Thrown when clarified argument is assigned to unsupported value

Fields
Methods

None

FinalAssignedException extends Exception

Thrown when finalized variable is reassigned

Fields
Methods

None

InternalException extends Exception

Thrown when something in Quail goes wrong
Usually indicates bugs in QRE
Report occasions to the developer

Fields

None

Methods

None

UnpackingException extends Exception

Thrown when for loop tries to unpack a value to wrong
number of variables. E.g. for a, b, c in some_dict
(dict can unpack only to key, value - 2 variables)

Fields
Methods

None

UnknownLibraryException extends Exception

Thrown when unknown library is being imported

Fields

None

Methods

None


Standard functions

bool all(list values)

Check if all given values are true

bool any(list values)

Check if any of given values is true

object clone(obj)

Clones given object

object copy(obj)

Copies given object

list enumerate(list collection)

Numerates given collection
E.g. enumerate(["a", "b", "c"]) -> [[0, "a"], [1, "b"], [2, "c"]]

list zip(list left, list right)

Zips 2 lists into one
E.g. zip([0, 1, 2], ["a", "b", "c"]) -> [[0, "a"], [1, "b"], [2, "c"]]

list map(func callback, list collection)

Applies given function to every item in collection and returns results of function in the order of application

num hash(obj)

Hashes given object

num millis()

Get current time in milliseconds

list zip(list a, list b)

Zips two lists into one list of pairs. E.g.:
zip([1, 2], ["a", "b"]) -> [[1, "a"], [2, "b"]]

string input(string prompt="")

Put given prompt to console, wait for user input and return it

void print(values...)

Print all values separated by space and put \n at the end

void put(values...)

Print all values separated by space, but do not put \n at the end

num abs(num n)

Absolute value of given number

num acos(num n)

Arc cosine of given number

num asin(num n)

Arc sine of given number

num atan(num n)

Arc tangent of given number

num atan2(num x, num y)

Arc tangent2 of given x;y

num cos(num n)

Cosine of given number

num cosh(num n)

Hyperbolic cosine of given number

num sum(list values)

Returns sum of all numbers in given collection

num max(list values)

Returns maximal value from given collection

num min(list values)

Returns minimal value from given collection

num sin(num n)

Sine of given number

num sinh(num n)

Hyperbolic sine of given number

num tan(num n)

Tangent of given number

num tanh(num n)

Hyperbolic tangent of given number

string bin(num n)

Convert given number to base-2 (integer only)

num dec(string n, num base)

Converts given number representation to in given base to base-10 (integer only)

string hex(num n)

Convert given number to base-16 (integer only)

string oct()

Convert given number to base-8 (integer only)

void writeFile(string path, string contents)

Writes file as plain text

string readFile(string path)

Reads file as plain text