get multimethod

Methods

get(arr:Arr, idx:Int, dflt:Any)
Get element at the given index or return dflt if the index is out of range (element at the given index does not exist)

Returns

Any

Example

[1,2,3].get(0, 10)  # 1
[1,2,3].get(5, 10)  # 10
get(h:Hash, k:Any, dflt:Any)
Get hash value by key or dflt if it does not exist

Returns

Any

Example

h = {"a": 1}
h.get("a", 10)  # 1
h.get("b", 10)  # 10
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).
get(hl:HashLike, k:Any, dflt:Any) Source: stdlib.ngs:795
Get value by key or dflt if it does not exist

Returns

Any
get(hl:HashLike, k:Any) Source: stdlib.ngs:799
Get value by key or null if it does not exist

Returns

Any
get(h:Hash, k:Any) Source: stdlib.ngs:1552
Get hash value by key or null if it does not exist

Example

h = {"a": 1}
h.get("a")  # 1
h.get("b")  # null
get(e:Eachable1, field:Str) Source: stdlib.ngs:1600
Return array made of given field of each element of given Eachable1 where present

Returns

Arr

Example

[{"x": 1}, {"y": 2}].get("x")  # [1]
``aws ec2 describe-instances``.Tags.get("role").uniq()
# Returns Arr of Str with roles. Does not crash if some machines do not have "role" tag.
get(e:Eachable1, field:Str, dflt:Any) Source: stdlib.ngs:1608
Return array made of given field of each element of given Eachable1 where present or default value where the field is not present.

Returns

Arr

Example

[{"x": 1}, {"y": 2}].get("x", null)  # [1, null]
get(a:Arr, idx:Int) Source: stdlib.ngs:1621
Get element by index or null if it does not exist

Returns

Any
get(fb:FullBox, dflt:Any=null) Source: stdlib.ngs:2898
Get FullBox value

Returns

Any

Example

Box(10).get()  # 10
get(eb:EmptyBox) Source: stdlib.ngs:2901
Get EmptyBox value. Always throws BoxFail.
get(eb:EmptyBox, dflt:Any) Source: stdlib.ngs:2907
Get EmptyBox value

Returns

dflt
get(s:Success) Source: stdlib.ngs:3044
Gets wrapped value

Returns

Any

Example

{ 1 / 10 }.Result().get()  # 0
get(f:Failure) Source: stdlib.ngs:3049
Throws ResultFail

Example

{ 1 / 0 }.Result().get()  # ResultFail exception
get(s:Success, dflt:Any) Source: stdlib.ngs:3055
Gets wrapped value

Returns

Any

Example

{ 1 / 10 }.Result().get(100)  # 0
get(f:Failure, dflt:Any) Source: stdlib.ngs:3059
Retruns dflt

Example

{ 1 / 0 }.Result().get(100)  # 100
get(ms:MatchSuccess) Source: stdlib.ngs:5565
Get the values of successfull match
get(mf:MatchFailure) Source: stdlib.ngs:5568
Throws ResultFail