[
{
"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."
},
{
"name": "try",
"arguments": ["T"],
"returns": "T",
"help": "Attempt to evaluate given expression and return null if it raised an error."
}
]
},
{
"title": "Comparison",
"functions": [
{
"name": "eq",
"arguments": ["s1", "s2"],
"returns": "bool",
"help": "Test string or list equality."
},
{
"name": "ne",
"arguments": ["s1", "s2"],
"returns": "bool",
"help": "Test string or list inequality."
},
{
"name": "gt",
"arguments": ["s1", "s2"],
"returns": "bool",
"help": "Test string or list s1 > s2."
},
{
"name": "ge",
"arguments": ["s1", "s2"],
"returns": "bool",
"help": "Test string or list s1 >= s2."
},
{
"name": "lt",
"arguments": ["s1", "s2"],
"returns": "bool",
"help": "Test string or list s1 < s2."
},
{
"name": "le",
"arguments": ["s1", "s2"],
"returns": "bool",
"help": "Test string or list s1 <= s2."
}
]
},
{
"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", "unit?"],
"returns": "number",
"help": "Return the smallest integer greater than or equal to x. Optionally ceil to nearest given unit."
},
{
"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": "int",
"arguments": ["any"],
"returns": "int",
"help": "Cast value as int and raise an error if impossible."
},
{
"name": "float",
"arguments": ["any"],
"returns": "float",
"help": "Cast value as float and raise an error if impossible."
},
{
"name": "floor",
"arguments": ["x", "unit?"],
"returns": "number",
"help": "Return the smallest integer lower than or equal to x. Optionally floor to nearest given unit."
},
{
"name": "log",
"arguments": ["x", "base?"],
"returns": "number",
"help": "Return the natural or custom base logarithm of x."
},
{
"name": "log2",
"arguments": ["x"],
"returns": "number",
"help": "Return the base 2 logarithm of x."
},
{
"name": "log10",
"arguments": ["x"],
"returns": "number",
"help": "Return the base 10 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", "unit?"],
"returns": "number",
"help": "Return x rounded to the nearest integer. Optionally round to nearest given unit."
},
{
"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", "unit?"],
"returns": "number",
"help": "Truncate the number by removing its decimal part. Optionally trunc to nearest given unit."
}
]
},
{
"title": "Formatting",
"functions": [
{
"name": "bytesize",
"arguments": ["string"],
"returns": "string",
"help": "Return a number of bytes in human-readable format (KB, MB, GB, etc.)."
},
{
"name": "escape_regex",
"arguments": ["string"],
"returns": "string",
"help": "Escape a string so it can be used safely in a regular expression."
},
{
"name": "fmt",
"arguments": ["string", "*arguments"],
"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": "lower",
"arguments": ["string"],
"returns": "string",
"help": "Lowercase string."
},
{
"name": "pad",
"arguments": ["string", "width", "char?"],
"returns": "string",
"help": "Pad given string with spaces or given character so that it is least given width."
},
{
"name": "lpad",
"arguments": ["string", "width", "char?"],
"returns": "string",
"help": "Left pad given string with spaces or given character so that it is least given width."
},
{
"name": "rpad",
"arguments": ["string", "width", "char?"],
"returns": "string",
"help": "Right pad given string with spaces or given character so that it is least given width."
},
{
"name": "printf",
"arguments": ["format", "*arguments"],
"returns": "string",
"help": "Apply printf formatting with given format and arguments. Arguments can also be provided as a list.\nFor instance: `split('John Landy') | printf('first: %s, last: %s', _)`"
},
{
"name": "numfmt",
"arguments": ["number", "thousands_sep=\",\"", "comma=false", "significance=5"],
"returns": "string",
"help": "Format a number with thousands separator and proper significance."
},
{
"name": "trim",
"arguments": ["string", "chars?"],
"returns": "string",
"help": "Trim string of leading & trailing whitespace or provided characters."
},
{
"name": "to_fixed",
"arguments": ["number", "precision"],
"returns": "string",
"help": "Format given number using fixed point notation with specified number of decimal places."
},
{
"name": "ltrim",
"arguments": ["string", "chars?"],
"returns": "string",
"help": "Trim string of leading whitespace or provided characters."
},
{
"name": "rtrim",
"arguments": ["string", "chars?"],
"returns": "string",
"help": "Trim string of trailing whitespace or provided characters."
},
{
"name": "upper",
"arguments": ["string"],
"returns": "string",
"help": "Uppercase string."
}
]
},
{
"title": "Strings",
"functions": [
{
"name": "count",
"arguments": ["string", "substring"],
"alternatives": [
["string", "regex"]
],
"returns": "int",
"help": "Count number of times substring appear in string. Or count the number of times a regex pattern matched the strings. Note that only non-overlapping matches will be counted in both cases. Remember a regex pattern must be written with slashes e.g. `/france|french/i`."
},
{
"name": "endswith",
"arguments": ["string", "substring"],
"returns": "bool",
"help": "Test if string ends with substring."
},
{
"name": "match",
"arguments": ["string", "regex", "group"],
"returns": "string",
"help": "Return a regex pattern match on the string. Remember a regex pattern must be written with slashes e.g. `/france|french/i`."
},
{
"name": "replace",
"arguments": ["string", "substring", "replacement"],
"alternatives": [
["string", "regex", "replacement"]
],
"returns": "string",
"help": "Replace all non-overlapping occurrences of substring in given string with provided replacement. Can also replace regex pattern matches. Remember a regex pattern must be written with slashes e.g. `/france|french/i`.\n\nSee regex replacement string syntax documentation here:\nhttps://docs.rs/regex/latest/regex/struct.Regex.html#replacement-string-syntax"
},
{
"name": "split",
"arguments": ["string", "substring", "max?"],
"alternatives": [
["string", "regex", "max?"]
],
"returns": "list",
"help": "Split a string by a given separator substring. Can also split using a regex pattern. Remember a regex pattern must be written with slashes e.g. `/france|french/i`."
},
{
"name": "startswith",
"arguments": ["string", "substring"],
"returns": "bool",
"help": "Test if string starts with substring."
}
]
},
{
"title": "Strings, lists and maps",
"functions": [
{
"name": "concat",
"arguments": ["string", "*strings"],
"returns": "string",
"help": "Concatenate given strings into a single one."
},
{
"name": "contains",
"arguments": ["string", "substring"],
"alternatives": [
["string", "regex"],
["list", "item"],
["map", "key"]
],
"returns": "bool",
"help": "If target is a string: return whether substring can be found in it or return whether given regular expression matched.\n\nIf target is a list, returns whether given item was found in it.\n\nIf target is a map, returns whether given key was found in it."
},
{
"name": "first",
"arguments": ["seq"],
"returns": "T",
"help": "Get first char of string or first item of list."
},
{
"name": "last",
"arguments": ["seq"],
"returns": "T",
"help": "Get last char of string or first item of list."
},
{
"name": "len",
"arguments": ["seq"],
"returns": "int",
"help": "Get number of chars in string or number of items in list."
},
{
"name": "get",
"arguments": ["string", "index", "default?"],
"alternatives": [
["list", "index", "default?"],
["map", "key", "default?"]
],
"returns": "any",
"help": "If target is a string, return the nth unicode char. If target is a list, return the nth item. Indices are zero-based and can be negative to access items in reverse. If target is a map, return the value associated with given key. All variants can also take a default value when desired item is not found."
},
{
"name": "slice",
"arguments": ["seq", "start", "end?"],
"returns": "seq",
"help": "Return slice of string or list."
}
]
},
{
"title": "Lists",
"functions": [
{
"name": "all",
"arguments": ["list", "lambda"],
"returns": "bool",
"help": "Returns whether the given lambda returned true for all elements of the list.\nFor instance: `all(names, name.startswith('A'))`"
},
{
"name": "any",
"arguments": ["list", "lambda"],
"returns": "bool",
"help": "Returns whether the given lambda returned true for any element of the list.\nFor instance: `any(names, name.startswith('A'))`"
},
{
"name": "compact",
"arguments": ["list"],
"returns": "list",
"help": "Drop all falsey values from given list."
},
{
"name": "filter",
"arguments": ["list", "lambda"],
"returns": "list",
"help": "Return a list containing only elements for which given lambda returned true.\nFor instance: `filter(names, name => name.startswith('A'))`"
},
{
"name": "find",
"arguments": ["list", "lambda"],
"returns": "any?",
"help": "Return the first item of a list for which given lambda returned true.\nFor instance: `find(names, name => name.startswith('A'))`"
},
{
"name": "find_index",
"arguments": ["list", "lambda"],
"returns": "int?",
"help": "Return the index of the first item of a list for which given lambda returned true.\nFor instance: `find_index(names, name => name.startswith('A'))`"
},
{
"name": "index_by",
"arguments": ["list", "key"],
"returns": "map",
"help": "Take a list of maps and a key name and return an indexed map from selected keys to the original maps."
},
{
"name": "join",
"arguments": ["list", "sep"],
"returns": "string",
"help": "Join list by separator."
},
{
"name": "map",
"arguments": ["list", "lambda"],
"returns": "list",
"help": "Return a list with elements transformed by given lambda.\nFor instance: `map(numbers, n => n + 3)`"
},
{
"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": "Maps",
"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": "Dates & time",
"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": "earliest",
"arguments": ["datetime1", "datetime2", "*datetimen"],
"alternatives": [["list_of_datetimes"]],
"returns": "datetime",
"help": "Return the earliest datetime."
},
{
"name": "latest",
"arguments": ["datetime1", "datetime2", "*datetimen"],
"alternatives": [["list_of_datetimes"]],
"returns": "datetime",
"help": "Return the latest datetime."
},
{
"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": "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": "mime_ext",
"arguments": ["string"],
"returns": "string",
"help": "Return the extension related to given mime type."
},
{
"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": "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": "soundex",
"arguments": ["name"],
"returns": "string",
"help": "Compute the SOUNDEX code (a phonetic encoding) of given name."
},
{
"name": "refined_soundex",
"arguments": ["name"],
"returns": "string",
"help": "Compute the refined SOUNDEX code (a phonetic encoding) of given name."
},
{
"name": "phonogram",
"arguments": ["name"],
"returns": "string",
"help": "Compute the \"phonogram\" code (yomguithereal's own phonetic encoding) of given name."
},
{
"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": "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": "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. Allow selecting inexisting columns, in which case it will return null."
},
{
"name": "header",
"arguments": ["name_or_pos", "nth?"],
"returns": "bytes",
"help": "Return header name for given column, by name, by position or by name & nth, in case of duplicate header names."
},
{
"name": "header?",
"arguments": ["name_or_pos", "nth?"],
"returns": "bytes",
"help": "Return header namefor given column, by name, by position or by name & nth, in case of duplicate header names. Allow selecting inexisting columns, in which case it will return null."
},
{
"name": "col_index",
"arguments": ["name_or_pos", "nth?"],
"returns": "bytes",
"help": "Return zero-based index of given column, by name, by position or by name & nth, in case of duplicate header names."
},
{
"name": "col_index?",
"arguments": ["name_or_pos", "nth?"],
"returns": "bytes",
"help": "Return zero-based index of given column, by name, by position or by name & nth, in case of duplicate header names. Allow selecting inexisting columns, in which case it will return null."
},
{
"name": "cols",
"arguments": ["from_name_or_pos?", "to_name_or_pos?"],
"returns": "list[bytes]",
"help": "Return list of cell values from the given column 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": "headers",
"arguments": ["from_name_or_pos?", "to_name_or_pos?"],
"returns": "list[string]",
"help": "Return list of header names from the given column 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": "regex",
"arguments": ["string"],
"returns": "regex",
"help": "Parse given string as regex. Useful when your patterns are dynamic, e.g. built from a CSV cell. Else prefer using regex literals e.g. \"/test/\"."
},
{
"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": "basename",
"arguments": ["path", "suffix?"],
"returns": "string",
"help": "Return the final component of given path, usually the file name, all while stripping it of an optional suffix."
},
{
"name": "cmd",
"arguments": ["string", "list[string]"],
"returns": "bytes",
"help": "Run a command using the provided list of arguments as a subprocess and return the resulting bytes trimmed of trailing whitespace."
},
{
"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": "dirname",
"arguments": ["path"],
"returns": "string",
"help": "Return target path without final component if any."
},
{
"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": "parse_json",
"arguments": ["string"],
"returns": "any",
"help": "Parse the given string as JSON."
},
{
"name": "parse_py_literal",
"arguments": ["string"],
"returns": "any",
"help": "Parse the given string as a python literal."
},
{
"name": "pathjoin",
"aliases": ["pjoin"],
"arguments": ["string", "*strings"],
"returns": "string",
"help": "Join multiple paths correctly."
},
{
"name": "read",
"arguments": ["path", "encoding=\"utf-8\"", "errors=\"strict\""],
"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": "shell",
"arguments": ["string"],
"returns": "bytes",
"help": "Convenience function running `cmd(\"$SHELL -c <command>\") ` on unix-like systems and `cmd(\"cmd \\C <command>\")` on Windows."
},
{
"name": "shlex_split",
"arguments": ["string"],
"returns": "list[string]",
"help": "Split a string of command line arguments into a proper list that can be given to e.g. the `cmd` function."
},
{
"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": "Randomness & hashing",
"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."
}
]
}
]