[
{
"title": "Arithmetics",
"functions": [
{
"name": "abs",
"arguments": ["x"],
"returns": "number",
"help": "Return absolute value of number."
},
{
"name": "add",
"arguments": ["x", "y", "*n"],
"returns": "number",
"help": "Add two or more numbers."
},
{
"name": "argmax",
"arguments": ["numbers", "labels?"],
"returns": "any",
"help": "Return the index or label of the largest number in the list."
},
{
"name": "argmin",
"arguments": ["numbers", "labels?"],
"returns": "any",
"help": "Return the index or label of the smallest number in the list."
},
{
"name": "ceil",
"arguments": ["x"],
"returns": "number",
"help": "Return the smallest integer greater than or equal to x."
},
{
"name": "div",
"arguments": ["x", "y", "*n"],
"returns": "number",
"help": "Divide two or more numbers."
},
{
"name": "idiv",
"arguments": ["x", "y"],
"returns": "number",
"help": "Integer division of two numbers."
},
{
"name": "floor",
"arguments": ["x"],
"returns": "number",
"help": "Return the smallest integer lower than or equal to x."
},
{
"name": "log",
"arguments": ["x"],
"returns": "number",
"help": "Return the natural logarithm of x."
},
{
"name": "max",
"arguments": ["x", "y", "*n"],
"alternatives": [
["list_of_numbers"]
],
"returns": "number",
"help": "Return the maximum number."
},
{
"name": "min",
"arguments": ["x", "y", "*n"],
"alternatives": [
["list_of_numbers"]
],
"returns": "number",
"help": "Return the minimum number."
},
{
"name": "mod",
"arguments": ["x", "y"],
"returns": "number",
"help": "Return the remainder of x divided by y."
},
{
"name": "mul",
"arguments": ["x", "y", "*n"],
"returns": "number",
"help": "Multiply two or more numbers."
},
{
"name": "neg",
"arguments": ["x"],
"returns": "number",
"help": "Return -x."
},
{
"name": "pow",
"arguments": ["x", "y"],
"returns": "number",
"help": "Raise x to the power of y."
},
{
"name": "round",
"arguments": ["x"],
"returns": "number",
"help": "Return x rounded to the nearest integer."
},
{
"name": "sqrt",
"arguments": ["x"],
"returns": "number",
"help": "Return the square root of x."
},
{
"name": "sub",
"arguments": ["x", "y", "*n"],
"returns": "number",
"help": "Subtract two or more numbers."
},
{
"name": "trunc",
"arguments": ["x"],
"returns": "number",
"help": "Truncate the number by removing its decimal part."
}
]
},
{
"title": "Boolean operations & branching",
"functions": [
{
"name": "and",
"arguments": ["a", "b", "*n"],
"returns": "T",
"help": "Perform boolean AND operation on two or more values."
},
{
"name": "if",
"arguments": ["cond", "then", "else?"],
"returns": "T",
"help": "Evaluate condition and switch to correct branch."
},
{
"name": "unless",
"arguments": ["cond", "then", "else?"],
"returns": "T",
"help": "Shorthand for `if(not(cond), then, else?)`"
},
{
"name": "not",
"arguments": ["a"],
"returns": "bool",
"help": "Perform boolean NOT operation."
},
{
"name": "or",
"arguments": ["a", "b", "*n"],
"returns": "T",
"help": "Perform boolean OR operation on two or more values."
}
]
},
{
"title": "Comparison",
"functions": [
{
"name": "eq",
"arguments": ["s1", "s2"],
"returns": "bool",
"help": "Test string or sequence equality."
},
{
"name": "ne",
"arguments": ["s1", "s2"],
"returns": "bool",
"help": "Test string or sequence inequality."
},
{
"name": "gt",
"arguments": ["s1", "s2"],
"returns": "bool",
"help": "Test string or sequence s1 > s2."
},
{
"name": "ge",
"arguments": ["s1", "s2"],
"returns": "bool",
"help": "Test string or sequence s1 >= s2."
},
{
"name": "lt",
"arguments": ["s1", "s2"],
"returns": "bool",
"help": "Test string or sequence s1 < s2."
},
{
"name": "le",
"arguments": ["s1", "s2"],
"returns": "bool",
"help": "Test string or sequence s1 <= s2."
}
]
},
{
"title": "String & sequence helpers",
"functions": [
{
"name": "compact",
"arguments": ["list"],
"returns": "list",
"help": "Drop all falsey values from given list."
},
{
"name": "concat",
"arguments": ["string", "*strings"],
"returns": "string",
"help": "Concatenate given strings into a single one."
},
{
"name": "contains",
"arguments": ["seq", "subseq"],
"returns": "bool",
"help": "Find if subseq can be found in seq. Subseq can be a regular expression."
},
{
"name": "count",
"arguments": ["seq", "pattern"],
"returns": "int",
"help": "Count number of times pattern appear in seq. Pattern can be a regular expression."
},
{
"name": "endswith",
"arguments": ["string", "pattern"],
"returns": "bool",
"help": "Test if string ends with pattern."
},
{
"name": "escape_regex",
"arguments": ["string"],
"returns": "string",
"help": "Escape a string so it can be used safely in a regular expression."
},
{
"name": "first",
"arguments": ["seq"],
"returns": "T",
"help": "Get first element of sequence."
},
{
"name": "fmt",
"arguments": ["string", "*replacements"],
"alternatives": [
["string", "map"]
],
"returns": "string",
"help": "Format a string by replacing \"{}\" occurrences by subsequent arguments.\n\nExample: `fmt(\"Hello {} {}\", name, surname)` will replace the first \"{}\" by the value of the name column, then the second one by the value of the surname column.\n\nCan also be given a substitution map like so:\n`fmt(\"Hello {name}\", {name: \"John\"})`."
},
{
"name": "get",
"arguments": ["target", "index_or_key", "default?"],
"returns": "T",
"help": "Get nth element of sequence (can use negative indexing), or key of mapping. Returns nothing if index or key is not found or alternatively the provided default value."
},
{
"name": "join",
"arguments": ["seq", "sep"],
"returns": "string",
"help": "Join sequence by separator."
},
{
"name": "last",
"arguments": ["seq"],
"returns": "T",
"help": "Get last element of sequence."
},
{
"name": "len",
"arguments": ["seq"],
"returns": "int",
"help": "Get length of sequence."
},
{
"name": "ltrim",
"arguments": ["string", "pattern?"],
"returns": "string",
"help": "Trim string of leading whitespace or provided characters."
},
{
"name": "lower",
"arguments": ["string"],
"returns": "string",
"help": "Lowercase string."
},
{
"name": "match",
"arguments": ["string", "pattern", "group"],
"returns": "string",
"help": "Return a regex pattern match on the string."
},
{
"name": "numfmt",
"arguments": ["number"],
"returns": "string",
"help": "Format a number with thousands separator and proper significance."
},
{
"name": "replace",
"arguments": ["string", "pattern", "replacement"],
"returns": "string",
"help": "Replace pattern in string. Can use a regex."
},
{
"name": "rtrim",
"arguments": ["string", "pattern?"],
"returns": "string",
"help": "Trim string of trailing whitespace or provided characters."
},
{
"name": "slice",
"arguments": ["seq", "start", "end?"],
"returns": "seq",
"help": "Return slice of sequence."
},
{
"name": "split",
"arguments": ["string", "sep", "max?"],
"returns": "list",
"help": "Split a string by separator."
},
{
"name": "startswith",
"arguments": ["string", "pattern"],
"returns": "bool",
"help": "Test if string starts with pattern."
},
{
"name": "trim",
"arguments": ["string", "pattern?"],
"returns": "string",
"help": "Trim string of leading & trailing whitespace or provided characters."
},
{
"name": "upper",
"arguments": ["string"],
"returns": "string",
"help": "Uppercase string."
}
]
},
{
"title": "Dates",
"functions": [
{
"name": "datetime",
"arguments": ["string", "format=?", "timezone=?"],
"returns": "datetime",
"help": "Parse a string as a datetime according to format and timezone. If no format is provided, string is parsed as ISO 8601 date format. Default timezone is the system timezone.\nhttps://docs.rs/jiff/latest/jiff/fmt/strtime/index.html#conversion-specifications"
},
{
"name": "strftime",
"arguments": ["target", "format"],
"returns": "string",
"help": "Format target (a time in ISO 8601 format, or the result of datetime() function) according to format."
},
{
"name": "timestamp",
"arguments": ["number"],
"returns": "datetime",
"help": "Parse a number as a POSIX timestamp in seconds (nb of seconds since 1970-01-01 00:00:00 UTC), and convert it to a datetime in local time."
},
{
"name": "timestamp_ms",
"arguments": ["number"],
"returns": "datetime",
"help": "Parse a number as a POSIX timestamp in milliseconds (nb of milliseconds since 1970-01-01 00:00:00 UTC), and convert it to a datetime in local time."
},
{
"name": "to_timezone",
"arguments": ["target", "timezone_in", "timezone_out"],
"returns": "datetime",
"help": "Parse target (a time in ISO 8601 format, or the result of datetime() function) in timezone_in, and convert it to timezone_out."
},
{
"name": "to_local_timezone",
"arguments": ["target"],
"returns": "datetime",
"help": "Parse target (a time in ISO 8601 format, or the result of datetime() function) in timezone_in, and convert it to the system's local timezone."
},
{
"name": "year_month_day",
"aliases": ["ymd"],
"arguments": ["target"],
"returns": "string",
"help": "Extract the year, month and day of a datetime. If the input is a string, first parse it into datetime, and then extract the year, month and day.\nEquivalent to `strftime(string, format=\"%Y-%m-%d\")`."
},
{
"name": "month_day",
"arguments": ["target"],
"returns": "string",
"help": "Extract the month and day of a datetime. If the input is a string, first parse it into datetime, and then extract the month and day.\nEquivalent to `strftime(string, format=\"%m-%d\")`."
},
{
"name": "month",
"arguments": ["target"],
"returns": "string",
"help": "Extract the month of a datetime. If the input is a string, first parse it into datetime, and then extract the month.\nEquivalent to `strftime(string, format=\"%m\")`."
},
{
"name": "year",
"arguments": ["target"],
"returns": "string",
"help": "Extract the year of a datetime. If the input is a string, first parse it into datetime, and then extract the year.\nEquivalent to `strftime(string, format=\"%Y\")`."
},
{
"name": "year_month",
"aliases": ["ym"],
"arguments": ["target"],
"returns": "string",
"help": "Extract the year and month of a datetime. If the input is a string, first parse it into datetime, and then extract the year and month.\nEquivalent to `strftime(string, format=\"%Y-%m\")`."
}
]
},
{
"title": "Higher-order functions",
"functions": [
{
"name": "filter",
"arguments": ["list", "lambda"],
"returns": "list",
"help": "Return a list containing only elements for which given lambda returned true."
},
{
"name": "map",
"arguments": ["list", "lambda"],
"returns": "list",
"help": "Return a list with elements transformed by given lambda."
}
]
},
{
"title": "Urls & web-related",
"functions": [
{
"name": "html_unescape",
"arguments": ["string"],
"returns": "string",
"help": "Unescape given HTML string by converting HTML entities back to normal text."
},
{
"name": "lru",
"arguments": ["string"],
"returns": "string",
"help": "Convert the given URL to LRU format.\nFor more info, read this: https://github.com/medialab/ural#about-lrus"
},
{
"name": "parse_dataurl",
"arguments": ["string"],
"returns": "[string, bytes]",
"help": "Parse the given data url and return its mime type and decoded binary data."
},
{
"name": "urljoin",
"arguments": ["string", "string"],
"returns": "string",
"help": "Join an url with the given addendum."
}
]
},
{
"title": "Collections (list of maps) functions",
"functions": [
{
"name": "index_by",
"arguments": ["collection", "key"],
"returns": "map",
"help": "Create a map from item key to collection item."
}
]
},
{
"title": "Map functions",
"functions": [
{
"name": "keys",
"arguments": ["map"],
"returns": "[string]",
"help": "Return a list of the map's keys."
},
{
"name": "values",
"arguments": ["map"],
"returns": "[T]",
"help": "Return a list of the map's values."
}
]
},
{
"title": "Aggregation functions",
"functions": [
{
"name": "mean",
"arguments": ["numbers"],
"returns": "number?",
"help": "Return the mean of the given numbers."
},
{
"name": "sum",
"arguments": ["numbers"],
"returns": "number?",
"help": "Return the sum of the given numbers, or nothing if the sum overflowed."
}
]
},
{
"title": "Fuzzy matching & information retrieval",
"functions": [
{
"name": "fingerprint",
"arguments": ["string"],
"returns": "string",
"help": "Fingerprint a string by normalizing characters, re-ordering and deduplicating its word tokens before re-joining them by spaces."
},
{
"name": "carry_stemmer",
"arguments": ["string"],
"returns": "string",
"help": "Apply the \"Carry\" stemmer targeting the French language."
},
{
"name": "s_stemmer",
"arguments": ["string"],
"returns": "string",
"help": "Apply a very simple stemmer removing common plural inflexions in some languages."
},
{
"name": "unidecode",
"arguments": ["string"],
"returns": "string",
"help": "Convert string to ascii as well as possible."
}
]
},
{
"title": "Utils",
"functions": [
{
"name": "coalesce",
"arguments": ["*args"],
"returns": "T",
"help": "Return first truthy value."
},
{
"name": "col",
"arguments": ["name_or_pos", "nth?"],
"returns": "bytes",
"help": "Return value of cell for given column, by name, by position or by name & nth, in case of duplicate header names."
},
{
"name": "cols",
"arguments": ["from_name_or_pos?", "to_name_or_pos?"],
"returns": "list[bytes]",
"help": "Return list of cell values from the given colum by name or position to another given column by name or position, inclusive. Can also be called with a single argument to take a slice from the given column to the end, or no argument at all to take all columns."
},
{
"name": "err",
"arguments": ["msg"],
"returns": "error",
"help": "Make the expression return a custom error."
},
{
"name": "float",
"arguments": ["any"],
"returns": "float",
"help": "Cast value as float and raise an error if impossible."
},
{
"name": "headers",
"arguments": ["from_name_or_pos?", "to_name_or_pos?"],
"returns": "list[string]",
"help": "Return list of header names from the given colum by name or position to another given column by name or position, inclusive. Can also be called with a single argument to take a slice from the given column to the end, or no argument at all to return all headers."
},
{
"name": "index",
"arguments": [],
"returns": "int?",
"help": "Return the row's index, if applicable."
},
{
"name": "int",
"arguments": ["any"],
"returns": "int",
"help": "Cast value as int and raise an error if impossible."
},
{
"name": "mime_ext",
"arguments": ["string"],
"returns": "string",
"help": "Return the extension related to given mime type."
},
{
"name": "parse_json",
"arguments": ["string"],
"returns": "any",
"help": "Parse the given string as JSON."
},
{
"name": "try",
"arguments": ["T"],
"returns": "T",
"help": "Attempt to evaluate given expression and return null if it raised an error."
},
{
"name": "typeof",
"arguments": ["value"],
"returns": "string",
"help": "Return type of value."
}
]
},
{
"title": "IO & path wrangling",
"functions": [
{
"name": "abspath",
"arguments": ["string"],
"returns": "string",
"help": "Return absolute & canonicalized path."
},
{
"name": "bytesize",
"arguments": ["string"],
"returns": "string",
"help": "Return a number of bytes in human-readable format (KB, MB, GB, etc.)."
},
{
"name": "copy",
"arguments": ["source_path", "target_path"],
"returns": "string",
"help": "Copy a source to target path. Will create necessary directories on the way. Returns target path as a convenience."
},
{
"name": "ext",
"arguments": ["path"],
"returns": "string?",
"help": "Return the path's extension, if any."
},
{
"name": "filesize",
"arguments": ["string"],
"returns": "int",
"help": "Return the size of given file in bytes."
},
{
"name": "isfile",
"arguments": ["string"],
"returns": "bool",
"help": "Return whether the given path is an existing file on disk."
},
{
"name": "move",
"arguments": ["source_path", "target_path"],
"returns": "string",
"help": "Move a source to target path. Will create necessary directories on the way. Returns target path as a convenience."
},
{
"name": "pathjoin",
"aliases": ["pjoin"],
"arguments": ["string", "*strings"],
"returns": "string",
"help": "Join multiple paths correctly."
},
{
"name": "read",
"arguments": ["path", "encoding=?", "errors=?"],
"returns": "string",
"help": "Read file at path. Default encoding is \"utf-8\". Default error handling policy is \"replace\", and can be one of \"replace\", \"ignore\" or \"strict\"."
},
{
"name": "read_csv",
"arguments": ["path"],
"returns": "list[map]",
"help": "Read and parse CSV file at path, returning its rows as a list of maps with headers as keys."
},
{
"name": "read_json",
"arguments": ["path"],
"returns": "any",
"help": "Read and parse JSON file at path."
},
{
"name": "write",
"arguments": ["string", "path"],
"returns": "string",
"help": "Write string to path as utf-8 text. Will create necessary directories recursively before actually writing the file. Return the path that was written."
}
]
},
{
"title": "Random",
"functions": [
{
"name": "md5",
"arguments": ["string"],
"returns": "string",
"help": "Return the md5 hash of string in hexadecimal representation."
},
{
"name": "random",
"arguments": [],
"returns": "float",
"help": "Return a random float between 0 and 1."
},
{
"name": "uuid",
"arguments": [],
"returns": "string",
"help": "Return a uuid v4."
}
]
}
]