# The MRQL System Functions

Infix arithmetic operators: +, -, *, /, %, <, <=, >, >=

Constants: PI

In the following system functions, `a` stands for any type, numeric stands for any numerical value, and all functions on bags can be applied to other collections types too.

 Name Input Output Description = (`a`,`a`) boolean equality (infix) <> (`a`,`a`) boolean not equal (infix) + (string,string) string string concatenation (infix) + (bag(`a`),bag(`a`)) bag(`a`) bag union (infix) .. (long,long) bag(long) a list of long integers from min to max (infix) min (numeric,numeric) numeric the minimum numerical value max (numeric,numeric) numeric the maximum numerical value abs numeric numeric the absolute value log numeric float/double natural logarithm exp numeric float/double e raised to the power of the value pow (double,double) double raise to the power round float int rounding a float into an integer round double long rounding a double into a long `@` double double where `@` is a math function from Java Math package (sin, cos, tan, asin, acos, atan, sqrt, ceil, floor, rint) toShort string short convert a string to a short toInt string int convert a string to an int toLong string long convert a string to a long toFloat string float convert a string to a float toDouble string double convert a string to a double toBool string boolean convert a string to a boolean string `a` string convert any MRQL type to a string contains (string,string) boolean true if the first string contains the second string length string int string size substring (string,int,int) string substring from beginIndex to endIndex split (string,string) string Splits this string around matches of the given regular expression trim string string Returns a copy of the string, with leading and trailing whitespace omitted replace (string,string,string) string Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence replaceAll (string,string,string) string Replaces each substring of this string that matches the given regular expression with the given replacement replaceFirst (string,string,string) string Replaces the first substring of this string that matches the given regular expression with the given replacement startsWith (string,string) boolean Tests if this string starts with the specified prefix toLowerCase string string Converts all of the characters in this String to lower case toUpperCase string string Converts all of the characters in this String to upper case count bag(`a`) long the number of elements in the bag sum bag(numeric) numeric sum of all values max bag(numeric) numeric maximum of all values min bag(numeric) numeric minimum of all values avg bag(numeric) float/double average of all values some bag(boolean) boolean true if any value in the bag is true all bag(boolean) boolean true if all the values in the bag are true exists bag(`a`) boolean true if the bag is not empty member (`a`,bag(`a`)) boolean true if the element is a member of the bag union (bag(`a`),bag(`a`)) bag(`a`) bag union (infix) intersect (bag(`a`),bag(`a`)) bag(`a`) bag intersection (infix) except (bag(`a`),bag(`a`)) bag(`a`) bag difference (infix) text XML string the text content of an XML node text list(XML) string the concatenated text content of an XML sequence tag XML string the tagname of an XML element node random int int return a random number between 0 and the argument - 1 (an impure function)) inv `a` Inv(`a`) invert the total order <= of the value
• No labels