Methods

collectorΒΆ

collector(h:Hash, body:Fun)

Defines collector { ... collect(...) ... } behaviour for hashes
Source: stdlib.ngs:842

h

Initial hash

body

The body after collector keyword and initial value, wrapped in a function "collector/{'my': 'hash'} THIS_CODE"

Returns

Constructed array

Example

arr = [{"Name": "n1", "Value": "v1"},{"Name": "n2", "Value": "v2"}]
my_hash = collector/{}
	arr.each(F(elt) collect(elt.Name, elt.Value))
echo(my_hash)  # Outputs: {n1=v1, n2=v2}