|
Messages Shared by
ConstList, String/Twine, FlexList, and ReadOnlyList
Since these are specific to lists, but are still shared between Const
and Flex lists, so they are only query operations.
Given
? pragma.syntax("0.8")
? def planets := ["earth", "mars"]
# value: ["earth", "mars"]
Concatenation
Example |
Meaning |
Expansion |
Value |
colors + planets
|
Result is the concatenation of the lists. |
colors.add(planets)
|
["red"
"green",
"blue",
"earth",
"mars"]
|
"hw" + "!"
|
hw.add("!")
|
"hello world!"
|
planets * 2
|
N concatenations of the list |
planets.multiply(2)
|
["earth",
"mars",
"earth",
"mars"]
|
".." * 3
|
"..".multiply(2)
|
"......"
|
Slicing
Example |
Meaning |
Expansion |
Value |
colors(0, 2)
|
Gets a run (sublist) of the list, from start inclusive
to stop exclusive. |
colors.run(0, 2)
|
["red",
"green"]
|
hw(0, 2)
|
hw.run(0, 2)
|
"he"
|
colors(0..!2)
|
Gets a run consisting of those elements of the list
at indices in the interval |
colors.run(0..!2)
|
["red",
"green"]
|
hw(0..!2)
|
hw.run(0..!2)
|
"he"
|
Conversion
Example |
Meaning |
Expansion |
Value |
list[2]
|
Indexing. Retrieves element #2 (the third element) |
list.get(2)
|
42
|
[3] == []
|
Are they the same? |
__equalizer.sameEver([3], [])
|
false
|
[3] != []
|
Are they different? |
__equalizer.sameEver([3], []).not()
|
true
|
Sorting
Example |
Meaning |
Expansion |
Value |
list[2]
|
Indexing. Retrieves element #2 (the third element) |
list.get(2)
|
42
|
[3] == []
|
Are they the same? |
__equalizer.sameEver([3], [])
|
false
|
[3] != []
|
Are they different? |
__equalizer.sameEver([3], []).not()
|
true
|
Searching for an Element
Example |
Meaning |
Expansion |
Value |
list[2]
|
Indexing. Retrieves element #2 (the third element) |
list.get(2)
|
42
|
[3] == []
|
Are they the same? |
__equalizer.sameEver([3], [])
|
false
|
[3] != []
|
Are they different? |
__equalizer.sameEver([3], []).not()
|
true
|
Searching for a Run
Example |
Meaning |
Expansion |
Value |
list[2]
|
Indexing. Retrieves element #2 (the third element) |
list.get(2)
|
42
|
[3] == []
|
Are they the same? |
__equalizer.sameEver([3], [])
|
false
|
[3] != []
|
Are they different? |
__equalizer.sameEver([3], []).not()
|
true
|
Printing
Example |
Meaning |
Expansion |
Value |
list[2]
|
Indexing. Retrieves element #2 (the third element) |
list.get(2)
|
42
|
[3] == []
|
Are they the same? |
__equalizer.sameEver([3], [])
|
false
|
[3] != []
|
Are they different? |
__equalizer.sameEver([3], []).not()
|
true
|
|
|