-
Notifications
You must be signed in to change notification settings - Fork 18
util.q
This library contains a set of general utility functions.
We define the use of the built-in command line argument -e to also define if the process is started in debug mode or not. By using -e 1, this function will return true.
Wraps the built-in system command to run it with protected execute. If the system command fails (i.e. the process exits with a non-zero status), this function will throw SystemCallFailedException. The error will also be logged to the console.
An extended version of the built-in trim function. As well as removing spaces from the beginning and end of a string, it also removes new line and tab characters.
A null like function with support for checking empty dictionaries, empty tables and lists will all null elements. Below are some examples of how this function differs to null:
q) null 1 2 3
000b
q) .util.isEmpty 1 2 3
0bq)null (`;0N;0Np;0Nf)
1111b
q).util.isEmpty (`;0N;0Np;0Nf)
1bq) null ()!()
q) .util.isEmpty ()!()
1bq) null flip `col1`col2!"SS"$\:()
col1 col2
---------
q) .util.isEmpty flip `col1`col2!"SS"$\:()
1bThis function will unenumerate any enumerated columns in an unkeyed table.
This function allows you to rename a column, or columns, in a table. The table should be unkeyed prior to passing into this function.
Copyright (C) Sport Trades Ltd 2017 - 2020, John Keys and Jaskirat Rajasansir 2020 - 2024