Language Design: Naming Conventions
Part 4: Lookup
Published on 2022-06-07. Last updated on 2022-07-26
Name | Example | Explanation |
---|---|---|
– | List(12.3, 45.6)(0) --> Some(12.3) Map("key", "val")("key") --> Some("val") |
|
at(idx) |
Array(12.3, 45.6).at(1) --> Some(Ref(arr, 1)) |
|
contains(val) |
List(1.0, -0.0, NaN).contains(0.0) --> true List(1.0, -0.0, NaN).contains(NaN) --> true Map("key", "val").contains("key") --> true |
|
includes(val) |
List(1.0, -0.0, NaN).includes(0.0) --> true List(1.0, -0.0, NaN).includes(NaN) --> false Map("key", "val").includes("key") --> true |
|
has(val) |
List(1.0, -0.0, NaN).has(0.0) --> false List(1.0, -0.0, NaN).has(NaN) --> true Map("key", "val").includes("key") --> true |
|
findFirst(pred) |
List(3, 1, 2, 3).findFirst(_ < 3) --> Some(1) |
|
findLast(pred) |
List(3, 1, 2, 3).findLast(_ < 3) --> Some(2) |
|