Return to index

list functions

bool = alltrue([]bool)

top

Returns true if all items in []bool evaluate to true.

Example:

# Example for alltrue
println alltrue(to_typed([true, false, true], "[]bool"))


boolean = anytrue([]bool)

top

Returns true if any item in []bool evaluates to true.

Example:

# Example for anytrue
println anytrue(to_typed([true, false, true], "[]bool"))


[]mixed = append([list,]item)

top

Returns new_list containing item appended to list. If list is omitted then a new list is created containing item.

Example:

# Example for append
println append([1, 2, 3], 4)


bool_success = append_to(list_name,item)

top

Appends item to local_list_name. Returns bool_success depending on success.

Example:

# Example for append_to
mylist = [1, 2]
append_to("mylist", 3)
println mylist


number = avg(list)

top

Calculate the average value in a list. Supports multi-dimensional arrays.

Example:

# Example for avg
println avg([10, 20, 30, 40])


[]string = col(string,column[,delimiter])

top

Creates a list from a particular column of line separated string.

Example:

# Example for col
text = "a b c\nd e f\ng h i"
println col(text, 2, " ")


[]new_list = concat(list,list)

top

(deprecated) Concatenates two lists and returns the result.

Example:

# Example for concat
println concat([1, 2], [3, 4])


bool = empty(list)

top

Is list empty?

Example:

# Example for empty
println empty([1, 2, 3])


bool = eqlen(list_of_lists_or_strings)

top

Checks that all lists or strings contained in the input are of equal length.

Example:

# Example for eqlen
println eqlen([[1, 2], [3, 4]])


bool = esplit([]list,"var1","var2",pos)

top

Split list at position pos (1-based). Each side is put into variables var1 and var2.

Example:

# Example for esplit
esplit([1, 2, 3], "a", "b", 2)  # usage


new_string = fieldsort(nl_string,field[,sort_type][,bool_reverse])

top

Sorts a newline separated string nl_string in ascending or descending (bool_reverse==true) order on key field.

Example:

# Example for fieldsort
println fieldsort("b:2\na:1", 1, ":")


item = head(list)

top

Returns the head element of a list.

Example:

# Example for head
println head(42)


[]new_list = insert(list,pos,item)

top

Returns a new_list with item inserted in list at position pos. (1-based)

Example:

# Example for insert
println insert([1, 3], 1, 2)


[]bigf_list = list_bigf(list)

top

Returns list as a list of big float containers. Invalid elements are discarded.

Example:

# Example for list_bigf
println list_bigf([1, 2, 3])


[]bigi_list = list_bigi(list)

top

Returns list as a list of big integer containers. Invalid elements are discarded.

Example:

# Example for list_bigi
println list_bigi([1, 2, 3])


[]bool = list_bool(int_or_string_list)

top

Returns int_or_string_list as a list of boolean values, with invalid items removed.

Example:

# Example for list_bool
println list_bool([1, 2, 3])


list = list_fill(list,value[,start,end])

top

sets all elements of a list to value. Big number types not yet supported.

Example:

# Example for list_fill
println list_fill([1, 2, 3], 42)


[]float_list = list_float(int_or_string_list)

top

Returns int_or_string_list as a list of floats, with invalid items removed.

Example:

# Example for list_float
println list_float([1, 2, 3])


[]int_list = list_int(float_or_string_list)

top

Returns float_or_string_list as a list of integers. Invalid items will generate an error.

Example:

# Example for list_int
println list_int([1, 2, 3])


[]int64_list = list_int64(list)

top

Returns list as a list of 64-bit integers.

Example:

# Example for list_int64
println list_int64([1, 2, 3])


[]string_list = list_string(list)

top

Converts list to a list of strings.

Example:

# Example for list_string
println list_string([1, 2, 3])


number = max(list)

top

Calculate the maximum value in a list. Supports multi-dimensional arrays.

Example:

# Example for max
println max([10, 20, 30, 40])


number = min(list)

top

Calculate the minimum value in a list. Supports multi-dimensional arrays.

Example:

# Example for min
println min([10, 20, 30, 40])


item = peek(list_name)

top

Returns a copy of the last item in the list list_name. Returns an error if the list is empty.

Example:

# Example for peek
println peek(to_typed([1, 2, 3], "[]int"))


item = pop(list_name)

top

Removes and returns the last item in the named list list_name.

Example:

# Example for pop
mylist = [1, 2, 3]
println pop("mylist")
println mylist


[]mixed = push_front([list,]item)

top

Adds item to the front of list. If only an item is provided, then a new list is started.

Example:

# Example for push_front
println push_front(to_typed([2, 3], "[]int"), 1)


[]new_list = remove(list,pos)

top

Returns a new_list with the item at position pos removed. 1-based.

Example:

# Example for remove
println remove([1, 2, 3], 1)


list = scan_left(numeric_list,op_string,start_seed)

top

Creates a list from the intermediary values of processing op_string while iterating over list.

Example:

# Example for scan_left
println scan_left(to_typed([1, 2, 3], "[]int"), "+", 0)


[]new_list = sort(list[,bool_reverse|map_options])

top

Sorts a list in ascending or descending (bool_reverse==true) order, or with map options.


Map options: .reverse (bool), .numeric (bool), .alphanumeric (bool), .key (backtick expression)

Example:

# Example for sort
sort(nil)  # usage


[]any = ssort(list,field_name[,bool_reverse])

top

Sorts a list of structs, on a given field name, in ascending (true) or descending (false) order.

Example:

# Example for ssort
println ssort([map(.name "banana"), map(.name "apple"), map(.name "cherry")], "name", true)


number|array = sum(list,axis,keepdims)

top

Calculate the sum of values. axis: -1/None=flatten, 0=first dim, 1=second dim. keepdims: preserve dimensions.

Example:

# Example for sum
println sum([1, 2, 3, 4, 5])


[]new_list = tail(list)

top

Returns a new list containing all items in list except the head item.

Example:

# Example for tail
println tail([1, 2, 3, 4, 5])


[]new_list = uniq([]list)

top

Returns list sorted with duplicate values removed.

Example:

# Example for uniq
text = "apple\napple\nbanana\nbanana\nbanana\ncherry"
println uniq(text)


list = zip(list1,list2)

top

Creates a list by combining each element of list1 and list2.

Example:

# Example for zip
println zip([1, 2, 3], [1, 2, 3])