Functions

Functions allow one to manipulate the input. The functions format is (<function-name> <arg0> <arg1> ..) where <argN> are functions or other types of selection. See additional help for selection for more details. See additional help with the group name to see the list of available functions in that group. Function group has those functions and groups:

  • Group basic -
    • Group flow - Contrlo flow functions
      • Function | - Pipe the output of one function to the next function.
      • Function default - Get the first non empty value.
      • Function ? - Return the second argument if the first argument is true. Return the third argument
    • Group collection - Functions that allow to use list or maps as collections
      • Function get - Get an item from an array by index or from a map by key.
      • Function size - Get the number of element in an array,
      • Function take - Take the first N of element in an array, object of string
      • Function take_last - Take the last N of element in an array, object of string
      • Function sub - If the first argument is a list, creates a new list that start from the second arguments and has the size of the third argument.
  • Group types -
    • Group check_types - Check the type of a value
      • Function array? - return true if the argument is an array.
      • Function object? - return true if the argument is an object.
      • Function null? - return true if the argument is a null.
      • Function bool? - return true if the argument is a boolean.
      • Function number? - return true if the argument is a number.
      • Function string? - return true if the argument is a string.
      • Function empty? - return true if the argument is nothing.
    • Group cast - Cast object to a predefine type
      • Function as_boolean - return the Boolean if the argument is a Boolean, nothing if it's not.
      • Function as_number - return the number if the argument is a number, nothing if it's not.
      • Function as_string - return the string if the argument is a string, nothing if it's not.
      • Function as_array - return the array if the argument is an array, nothing if it's not.
      • Function as_object - return the object if the argument is an object, nothing if it's not.
  • Group list -
    • Group list_producers - Functions to create lists
      • Function range - Create a new list with items from 0 to the second argument.
      • Function zip - Zip a few list into a new list.
      • Function cross - Join a few list (i.e. Cartesian product) into a new list.
    • Group list_manipluations - Function to manipulatre a list and create a new one
      • Function sort - Sort a list.
      • Function sort_unique - Sort a list and remove duplicates.
      • Function indexed - Map a list into a new list where each element in the new list is an object with two elements:
      • Function push - Add items to a list.
      • Function push_front - Add items to the from of a list.
      • Function reverese - Reveres the order of a list.
      • Function pop - Pop the last item from a list.
      • Function pop_first - Pop the first item from a list.
    • Group list_functional - Functional function over a list of items
      • Function filter - Filter a list.
      • Function group_by - Group items by function.
      • Function sort_by - Sort a list.
      • Function fold - Fold all the items in a list into a new value.
      • Function map - Map a list into a new list using a function.
      • Function flat_map - Flat map a list into a new list using a function.
    • Group list_folding - Function top fold a list into a single item
      • Function sum - Sum all the items in the list.
      • Function any - Check if any of item in a list is ture.
      • Function all - Check if all the items in a list are true.
      • Function join - Join all the items in the list into a String.
      • Function first - The first item in a list.
      • Function last - The last item in a list.
  • Group object -
    • Group object_to_list - Convert an object into a list
      • Function keys - Get the list of keys from an object.
      • Function values - Get the list of values from an object.
      • Function entries - Get the list of all the entries of an obejct. Each item of the list will be an object with key and value entries
    • Group sort_objects - Sort an object
    • Group manipulate_object - Manipulate objects to pruduce a new object
      • Function put - Add a new entry to a map.
      • Function insert_if_absent - Add a new entry to a map if it has no such key.
      • Function replace_if_exists - Add a new entry to a map if it has such key.
    • Group functional_object - Functional function over an object
  • Group number -
    • Function + - If all the arguments are number, add them.
    • Function - - If there are two numeric arguments, substract the second argument from the first one if both are number.
    • Function * - If all the arguments are number, multiply them.
    • Function / - Divide the firs argument by the second argument. If the second argument is 0 will return nothing
    • Function % - Find the reminder of the division of the firs argument by the second argument. If the second argument is 0 will return nothing
    • Function abs - If the argument is numeric, return it's absolute value.
    • Function round - If the argument is numeric, return it's rounded.
    • Function ceil - If the argument is numeric, return it's ceiling.
    • Function floor - If the argument is numeric, return it's floor.
  • Group string -
    • Function env - Get enviornment variable.
    • Function concat - Concat all string arguments.
    • Function head - Extract a string header.
    • Function tail - Extract a string tail.
    • Function split - Split the string into array of strings.
    • Function base63_decode - Decode a BASE64 string and try to convert to a string using UTF8.
    • Group parse_and_stringify - Function to parse from a string or to convert an object into a string
      • Function stringify - Return the JSON represantation of the object.
      • Function parse - Parse a string into JSON value.
      • Function parse_selection - Parse a string into a new selection.
    • Group regex - Regular expression functions
      • Function match - Return true if the first string argument match the second regular expression argument.
      • Function extract_regex_group - Return the capture group within the string.
  • Group boolean -
    • Group compare - Compatison functions
      • Function = - Compare two value and return true if both are equals.
      • Function != - Compare two value and return true if both are not equals.
      • Function < - Compare two value and return true if the first is smaller than the second.
      • Function <= - Compare two value and return true if the first is smaller or eqauls than the second.
      • Function >= - Compare two value and return true if the first is greater or eqauls than the second.
      • Function > - Compare two value and return true if the first is greater than the second.
    • Group logical - Logical function
      • Function and - Return true if all the arguments are true, nothing if there is a non boolean argument and false if there is a false argument.
      • Function or - Return true if any of the arguments are true, nothing if there is a non boolean argument and false if all the arguments are false.
      • Function xor - Return true if one, and only one, of the argument is true.
      • Function not - Return false if the argument is true and true if the argument is false.
  • Group time -
    • Function now - Return the current time as seconds since epoch.
    • Function format_time - Format a date/time into a string
    • Function parse_time_with_zone - Parse a date/time from a string into seconds since epoc. This version expect to get the time zone as well
    • Function parse_time - Parse a date/time from a string into seconds since epoc
  • Group variables -
    • Function set - Set a variable. The first argument should be the variable name, the second one should be the value and the third
    • Function : - Return the value of a named variable. See set for examples.
    • Function define - Define a new macro definition. The first argument should be the macro definition name, the second one should be macro and the third
    • Function @ - Return the value of a named variable. See define for examples.
  • Group proccess -
    • Function exec - Execute an external proccess and wait for it's completion.
    • Function trigger - Trigger an external proccess and return it's process ID.
  • Group nas - NAS - Number As String, i.e. number that represent as string, like "12" instead of 12.
    • Group nas_arithmetic - Number As String arithmetic functions.
      • Function "||" - If the argument is string as number, return it in a normelize form (to allow a constent uniquness check).
      • Function "+" - If all the arguments are numbers as string number, add them.
      • Function "-" - If there are two numeric arguments, substract the second argument from the first one if both are number.
      • Function "*" - If all the arguments are numbers as string, multiply them.
      • Function "/" - Divide the firs argument by the second argument if both are strings as numbers. If the second argument is "0" will return nothing
      • Function "%" - Find the reminder of the division of the firs argument by the second argument if both are strings as number. If the second argument is "0" will return nothing
      • Function "abs" - If the argument is numnber as string, return it's absolute value as string.
      • Function "round" - If the argument is string as number, return it's rounded.
    • Group nas_compare - Number As String comparison functions.
      • Function "=" - Compare two string as numbers and return true if both are equals.
      • Function "!=" - Compare two number as strings and return true if both are not equals.
      • Function ">" - Compare two numbers as string and return true if the first is greater than the second.
      • Function "<" - Compare two numbers as string and return true if the first is smaller than the second.
      • Function ">=" - Compare two numbers and string and return true if the first is greater or eqauls than the second.
      • Function "<=" - Compare two numbers and string and return true if the first is smaller or eqauls than the second.
      • Function "sort_by" - Sort a list using number as strings.

Use additional help with a function name to see more details about the function.