Collect : Collecting Values
** Collect ** is the most basic collector of the
OMLoop module. It collects the values returned to its input in a list.
Inputs and Outputs
Collect has one default input and three outputs :
-
“what” : collects successive values coming from other boxes
-
first output : appends each new value returned to its input, and returns this new element as a list
-
second output : returns the list of the collected elements
-
third output : resets the collected list to “nil”, and returns an empty list.
—|—
Example : Building a Random List of Numbers
We want to make a list with seven random numbers between 1 and 100.
-
Forloop defines a number of loops . The iteration will stop after seven loops.
-
Om-random calculates a random number, which is printed at each loop by EachTime and print.
-
At each step, the successive elements are collected by collect.
-
After seven loops, the iteration is stopped by forloop.
-
When the iteration stops, Finally returns the list of the numbers collected by collect.
—|—
References :
Contents :