n-values2.0

n-values size reporter

Reports a list of length size containing values computed by repeatedly running the reporter. reporter may be an anonymous reporter or the name of a reporter.

If the reporter accepts inputs, the input will be the number of the item currently being computed, starting from zero.

If size is fractional, it will be rounded down to the nearest integer (4.5 becomes 4, 10.9 becomes 10).

show n-values 5 [1]
=> [1 1 1 1 1]
show n-values 5 [ i -> i ]
=> [0 1 2 3 4]
show n-values 3 turtle
=> [(turtle 0) (turtle 1) (turtle 2)]
show n-values 5 [ x -> x * x ]
=> [0 1 4 9 16]

See also reduce, filter, -> (anonymous procedure), range.

Take me to the full NetLogo Dictionary