Generic List Length Calculation
Description
This operator is used to calculate the sum of elements or the length (i.e., the number of elements) in the input list.
Scenarios
-
Counting: In any part of the process where the list size needs to be known, for example, determining how many objects were detected or how many data points were received.
-
Logic Judgment: Using the output "List length" as input for a subsequent "General Condition Judgment" operator to implement quantity-based flow control (e.g., execute grab only when the detected quantity is greater than 0).
-
Calculating Data: When list elements are numbers or lists, it can quickly calculate the sum.
Inputs and Outputs
Inputs |
Input List: A list of any type. |
Outputs |
List Length: An integer representing the total number of elements in the input list. List Sum: Sums the elements directly when they are numeric; when elements are lists, it sums their lengths; for other types, it returns an empty value. |