Holder type

A mutable container.

Methods

get(h:Holder) Source: stdlib.ngs:4714
Get the held value

Example

Holder(10).get()  # 10
get_and_update(h:Holder, cb:Fun) Source: stdlib.ngs:4723
Extract a value and modify .val in place.

Parameters

cbCalled with the old value. Returns [value_to_return, new_value_to_hold].

Returns

cb(...)[0]

Example

h = Holder([1, 2, 3])
h.get_and_update(F(a) [a[0], a[1..null]])  # 1
h.val  # [2, 3]
init(h:Holder, val:Any) Source: stdlib.ngs:4710
Holder constructor