This topic describes the syntax of list functions and provides parameter description and function examples.
Functions
Type | Function | Description |
---|---|---|
List processing | lst_make | Constructs a list. |
lst_insert | Inserts values to a list at a specified position. | |
lst_append | Adds values to the end of a list. | |
lst_delete_at | Deletes a value from a list at a specified position. | |
lst_reverse | Reverses the order of values in a list. | |
op_slice | Obtains values at specified positions from a list. |
lst_make
- Syntax
lst_make(Value 1, Value 2, ...)
- Parameters
Parameter Type Required? Description Value 1 Any type Yes The value used to construct the list. Value 2 Any type Yes The value used to construct the list. - Response
The constructed list is returned.
- Examples
Processing rule:
e_set("hello", lst_make("k1","k2"))
Processing result:hello: ["k1","k2"]
lst_insert
- Syntax
lst_insert(List, Position, Value 1, Value 2, ...)
- Parameters
Parameter Type Required? Description List List Yes The list to which you want to insert the values. Position Number Yes The position where you want to insert the values. Value 1 Any type Yes The value to insert. Value 2 Any type No The value to insert. - Response
The updated list is returned.
- Examples
Raw log:
ctx: ["k1","k2"]
Processing rule:e_set("hello", lst_insert(v("ctx"), 0, "k0"))
Processing result:ctx: ["k1","k2"] hello: ["k0", "k1", "k2"]
lst_append
- Syntax
lst_append(List, Value 1, Value 2, ...)
- Parameters
Parameter Type Required? Description List List Yes The list to which you want to append the values. Value 1 Any type Yes The value to add. Value 2 Any type No The value to add. - Response
The updated list is returned.
- Examples
Raw log:
ctx: ["k1","k2"]
Processing rule:e_set("hello", lst_append(v(ctx), "k3"))
Processing result:ctx: ["k1","k2"] hello: ["k1", "k2", "k3"]
lst_delete_at
- Syntax
lst_delete_at(List, Position)
- Parameters
Parameter Type Required? Description List List Yes The list from which you want to delete the value. Position Number Yes The position of the value to delete. The position of the first value is 0. - Response
The updated list is returned.
- Examples
Raw log:
ctx: ["k1","k2"]
Processing rule:e_set("hello", lst_delete_at(v("ctx"),1))
Processing result:ctx: ["k1","k2"] hello: ["k1"]
lst_reverse
- Syntax
lst_reverse(List)
- Parameters
Parameter Type Required? Description List List Yes The list for which you want to reverse the order of values. - Response
The updated list is returned.
- Examples
Raw log:
ctx: ["v1","v2"]
Processing rule:e_set("hello", lst_reverse(v("ctx")))
Processing result:ctx: ["v1","v2"] hello: ["v2","v1"]