ArrLike type

Parent type for user-defined types with array-like behaviour. Use in cases when you would like to inherit from built-in Arr. Inheriting from built-ins is not possible for now.


type T(ArrLike)
F Str(t:T) "<My array has ${len(t)} items totalling ${sum(t)}>"  # Override one of the Arr methods
a = T()
echo(a)  # <My array has 2 items totalling 30>

# If you need init() you should have something like the following to allow ArrLike initialization:
init(t:T) {

Direct parent types

Eachable which each() calls the callback with one argument
Direct subtypes: 16

Direct children types

EXPERIMENTAL. Delimited string. Showing ArrLike usage.
Array of strings which comprise a text which is treated as a unit for purposes of output (and maybe for other purposes later).


.(al:ArrLike, s:Str) Source: stdlib.ngs:749
Return array made of given field of each element of given array. Will throw KeyNotFound if any of the elements does not have the desired field. Use get() to handle missing field differently.
[](al:ArrLike, idx:Int) Source: stdlib.ngs:718
Set element in the underlying array.
[]=(al:ArrLike, idx:Int, x:Any) Source: stdlib.ngs:721
Get element from the underlying array.
Arr(al:ArrLike) Source: stdlib.ngs:734
Get the underlying array
Bool(al:ArrLike) Source: stdlib.ngs:730
Check whether al has any elements.
collector(al:ArrLike, body:Fun) Source: stdlib.ngs:754
Defines collector { ... collect(...) ... } behaviour for ArrLike. Very similar to collector for Arr. See collector(Arr,Fun).
each(al:ArrLike, cb:Fun) Source: stdlib.ngs:727
Call cb for each element in the underlying array.
get(al:ArrLike, idx:Int, dflt:Any) Source: stdlib.ngs:724
Get element at the given index or return dflt if the index is out of range (element at the given index does not exist). See get(Arr).
init(al:ArrLike) Source: stdlib.ngs:695
init(al:ArrLike, field:Str=null) Source: stdlib.ngs:705
Throws NotImplemented if field is specified


fieldDEPRECATED name of the field that holds the underlying array.
init(al:ArrLike, arr:Arr) Source: stdlib.ngs:710
join(al:ArrLike, s:Str) Source: stdlib.ngs:744
Join items to a single string using given seperator s


len(al:ArrLike) Source: stdlib.ngs:715
Get length of the underlying array.
push(al:ArrLike, val:Any) Source: stdlib.ngs:738
Push an element to the underlying array.
without(ds:ArrLike, without_elt:Any) Source: autoload/DelimStr.ngs:27
Get new DelimStr without the given element


DelimStr("/bin:/usr/bin:/usr/local/bin").without("/usr/bin").Str()  # "/bin:/usr/local/bin"