Methods

collectorΒΆ

collector(n:Int, body:Fun)

Defines collector { ... collect(...) ... } behaviour for integers (summarizes collected items).
Source: stdlib.ngs:853

n

Initial number

body

The body after collector keyword and initial value, wrapped in a function "collector/100 THIS_CODE"

Returns

Constructed array

Example

collector/0 { (1...10).each(collect) }  # 55