Answers a List holding the given item the given number of times.
A count of zero or less answers the empty List.
ItemTypethe item to repeatIntegerhow many copies the List holdsReturns the List of repeated items.
Ordered collections of items: reading, searching, transforming, sorting and totalling, each method returning a new List.
Taught on: Lists and Iteration.
namespace List<infer ItemType> for List<ItemType>Printable where ItemType is PrintableEquatable where ItemType is EquatableComparable where ItemType is Comparabletype NonEmptyList<ItemType> = List<ItemType> where @::hasItems()A List proven to have an item in it, as a checked refinement of List.NestedList for List<List<ItemType>> in Nested listsNonEmptyNestedList for NonEmptyList<NonEmptyList<ItemType>> in Nested listsOptionalList for List<Optional<ItemType>> in Lists of Optionals and ResultsResultList for List<Result<ValueType, FailureType>> in Lists of Optionals and ResultsGroupedList for List<ItemType> in Grouping into a DictionaryGroupedNonEmptyList for NonEmptyList<ItemType> in Grouping into a DictionaryIntegerList for List<Integer> in Lists of numbers: totalsRationalList for List<Rational> in Lists of numbers: totalsNumberList for List<Scalar> in Lists of numbers: totalsKeyedNumberList for List<ItemType> in Lists of numbers: totalsNonEmptyIntegerList for NonEmptyList<Integer> in Lists of numbers: statisticsNonEmptyRationalList for NonEmptyList<Rational> in Lists of numbers: statisticsNonEmptyNumberList for NonEmptyList<Scalar> in Lists of numbers: statisticsNonEmptyKeyedNumberList for NonEmptyList<ItemType> in Lists of numbers: statisticsA view is a namespace for a narrower type. A value of that type has the view's methods on top of its own.
SortOrderWhich way sort runs: #Ascending from the lowest, or #Descending from the highest.on List
Answers a List holding the given item the given number of times.
A count of zero or less answers the empty List. A count proven to be above zero answers a List with something in it.
Answers a List holding the given item the given number of times.
A count of zero or less answers the empty List.
ItemTypethe item to repeatIntegerhow many copies the List holdsReturns the List of repeated items.
Answers a List holding the given item a number of times proven to be above zero.
At least one copy is held, so the answer certainly has something in it.
ItemTypethe item to repeatReturns the List of repeated items, which is never empty.
on List
Answers the Integers of a range, counting up or down, one step at a time.
The through: and upTo: entries count up, and the downTo: entry counts down. The by: entries move by the given step instead of by one. The end is included where the label is through: or downTo:, and excluded where it is upTo:.
Returns the List of Integers.
Answers the Integers from one value up through another, both included.
The count only runs up. An end below the start answers the empty List. To count down, use the downTo: entry.
Integerthe first Integer of the ListIntegerthe last Integer of the List, which is includedReturns the List of Integers. It is empty when the end is below the start.
Answers the Integers from one value up to, but not including, another.
The count only runs up. An end at or below the start answers the empty List.
Integerthe first Integer of the ListIntegerthe Integer the List stops beforeReturns the List of Integers. It is empty when the end is not above the start.
Answers the Integers from one value down through another, both included.
The count only runs down. The first value is always answered, so an end above the start answers a List holding that value alone. The answer certainly has something in it.
Integerthe first Integer of the ListIntegerthe last Integer of the List, which is includedReturns the List of Integers, which is never empty.
Answers the Integers from one value through another, moving by the given step.
The step is added each turn, and the walk stops where a step passes the end. A step that moves away from the end answers the empty List.
Integerthe first Integer of the ListIntegerthe value the walk stops at or before, which is included when a step reaches itReturns the List of Integers. It is empty when the step moves away from the end.
Answers the Integers from one value up to, but not including, another, moving by the given step.
The step is added each turn, and the walk stops before the end. A step that moves away from the end answers the empty List.
Integerthe first Integer of the ListIntegerthe Integer the walk stops beforeReturns the List of Integers. It is empty when the step moves away from the end.
Answers the Integers from one value down through another, moving by the given step.
The step is added each turn, and the walk stops where a step passes the end. The first value is always answered, so a step that moves away from the end answers a List holding that value alone.
Integerthe first Integer of the ListIntegerthe value the walk stops at or before, which is included when a step reaches itReturns the List of Integers, which is never empty.
on List<ItemType>
Answers whether the two Lists hold the same items in the same order.
Each pair of items is compared with the items' own is. The Method is available whenever the items conform to Equatable.
List<ItemType>the List to compare withReturns true when the Lists are equal.
on List<ItemType>
Answers how the List orders against another one, comparing them lexicographically.
The first differing pair of items decides. On an equal prefix the shorter List comes first. The Method is available whenever the items conform to Comparable.
List<ItemType>the List to compare withReturns Ordering#Less, Ordering#Equal or Ordering#Greater.
on List<ItemType>
Answers the List and its items as a String, in the form [1, 2, 3].
Each item is rendered by its own toString, and a String item is quoted: ["a", "b"] answers ["a", "b"]. A String prints bare on its own and quoted inside a structure. The empty List answers []. The Method is available whenever the items conform to Printable.
Returns the String representation of the List.
on List<ItemType> · provided by Equatable where ItemType is Equatable
Answers whether the values differ.
List<ItemType>the value to compare withReturns true when the values differ.
on List<ItemType> · provided by Comparable where ItemType is Comparable
Answers whether the value is strictly below another.
List<ItemType>the value to compare withReturns true when the value is below the given one.
on List<ItemType> · provided by Comparable where ItemType is Comparable
Answers whether the value is below another, or equal to it.
List<ItemType>the value to compare withReturns true when the value is below the given one or equal to it.
on List<ItemType> · provided by Comparable where ItemType is Comparable
Answers whether the value is strictly above another.
List<ItemType>the value to compare withReturns true when the value is above the given one.
on List<ItemType> · provided by Comparable where ItemType is Comparable
Answers whether the value is above another, or equal to it.
List<ItemType>the value to compare withReturns true when the value is above the given one or equal to it.
on List<ItemType>
Answers whether the List has an item, or has an item the check accepts.
Returns true when the List has an item, or when the check accepts an item.
Answers whether the List has at least one item.
It is the opposite of isEmpty.
Returns true when the List is not empty.
Answers whether the check accepts at least one item.
The walk stops at the first accepted item. The empty List has no item to accept, so it answers false.
(_: ItemType) -> Booleanthe check each item is offered toReturns true when the check accepts an item.
on List<ItemType>
Answers whether the List has no items at all.
Returns true for the empty List.
on List<ItemType>
Answers whether the check accepts every item.
The walk stops at the first item the check refuses. The empty List has no item to fail the check, so it answers true.
(_: ItemType) -> Booleanthe check each item is offered toReturns true when the check accepts every item.
on List<ItemType>
Answers whether the check accepts no item at all.
The walk stops at the first accepted item. The empty List has no item to accept, so it answers true.
(_: ItemType) -> Booleanthe check each item is offered toReturns true when the check accepts no item.
on List<ItemType>
Answers whether any item occurs twice, or whether any two items share a key.
Equality is the items' own is, or the keys' own where a key is read. The walk stops at the first repeat.
Returns true when something occurs twice.
Answers whether any item occurs twice.
The walk stops at the first repeated item. The empty List and a List of one item answer false. Equality is the items' own is. The entry is available whenever the items conform to Equatable.
Returns true when an item occurs twice.
Answers whether any two items share the key the given Function reads off each one.
The walk stops at the first repeated key. Equality is the keys' own is. The entry is available whenever what the key answers conforms to Equatable.
(_: ItemType) -> Keythe key read off each itemReturns true when two items share a key.
on List<ItemType>
Answers whether the items are in order.
Items the order does not tell apart are in order either way. The empty List and a List of one item are both in order. The Method is available whenever the items conform to Comparable.
Returns true when no item stands out of that order.
on List<ItemType>
Answers whether an item equal to the given one is in the List, or whether every item of another List is.
Equality is the items' own is. The Method is available whenever the items conform to Equatable.
Returns true when the item occurs, or when every item of the other List does.
Answers whether an item equal to the given one is in the List.
Equality is the items' own is. The entry is available whenever the items conform to Equatable.
ItemTypethe item to look forReturns true when the item occurs.
Answers whether every item of the given List occurs in this one.
How many times an item occurs is not asked, so a List holding one 1 contains every item of [1, 1]. The empty List has no item to look for, so every List contains its items. The walk stops at the first item that does not occur. Equality is the items' own is. The entry is available whenever the items conform to Equatable.
List<ItemType>the List whose items to look forReturns true when every item of it occurs.
on List<ItemType>
Answers whether no item equal to the given one is in the List.
Equality is the items' own is. The Method is available whenever the items conform to Equatable.
ItemTypethe item to look forReturns true when the item does not occur.
on List<ItemType>
Answers whether the List begins with the items of the given one.
Equality is the items' own is. The Method is available whenever the items conform to Equatable. Every List begins with the empty List.
List<ItemType>the leading items to look forReturns true when the List begins with those items.
on List<ItemType>
Answers whether the List does not begin with the items of the given one.
Equality is the items' own is. The Method is available whenever the items conform to Equatable.
List<ItemType>the leading items to look forReturns true when the List begins with other items.
on List<ItemType>
Answers whether the List ends with the items of the given one.
Equality is the items' own is. The Method is available whenever the items conform to Equatable. Every List ends with the empty List.
List<ItemType>the trailing items to look forReturns true when the List ends with those items.
on List<ItemType>
Answers whether the List does not end with the items of the given one.
Equality is the items' own is. The Method is available whenever the items conform to Equatable.
List<ItemType>the trailing items to look forReturns true when the List ends with other items.
on List<ItemType>
Answers the position of the first item equal to the given one, or of the first item the check accepts.
A List without such an item answers nothing, and the defaultingTo: entries answer the given position instead.
Answers the position of the first item equal to the given one.
Equality is the items' own is. The entry is available whenever the items conform to Equatable.
ItemTypethe item to look forReturns the zero-based position, or nothing when the item is absent.
Answers the position of the first item the check accepts.
(_: ItemType) -> Booleanthe check each item is offered toReturns the zero-based position, or nothing when no item is accepted.
Answers the position of the first item equal to the given one, or the given fallback when the item is absent.
Equality is the items' own is. The entry is available whenever the items conform to Equatable.
ItemTypethe item to look forIntegerthe position to answer with when the item is absentReturns the zero-based position, or the fallback in its place.
Answers the position of the first item the check accepts, or the given fallback when it accepts none.
(_: ItemType) -> Booleanthe check each item is offered toIntegerthe position to answer with when no item is acceptedReturns the zero-based position, or the fallback in its place.
on List<ItemType>
Answers the position of the last item equal to the given one, or of the last item the check accepts.
A List without such an item answers nothing, and the defaultingTo: entries answer the given position instead.
Answers the position of the last item equal to the given one.
Equality is the items' own is. The entry is available whenever the items conform to Equatable.
ItemTypethe item to look forReturns the zero-based position, or nothing when the item is absent.
Answers the position of the last item equal to the given one, or the given fallback when the item is absent.
Equality is the items' own is. The entry is available whenever the items conform to Equatable.
ItemTypethe item to look forIntegerthe position to answer with when the item is absentReturns the zero-based position, or the fallback in its place.
Answers the position of the last item the check accepts.
The walk runs backwards and stops at the first item it accepts.
(_: ItemType) -> Booleanthe check each item is offered toReturns the zero-based position, or nothing when no item is accepted.
Answers the position of the last item the check accepts, or the given fallback when it accepts none.
(_: ItemType) -> Booleanthe check each item is offered toIntegerthe position to answer with when no item is acceptedReturns the zero-based position, or the fallback in its place.
on List<ItemType>
Answers the positions of every item equal to the given one, in order.
Equality is the items' own is. The Method is available whenever the items conform to Equatable. A List without the item answers no positions.
ItemTypethe item to look forReturns the List of positions the item stands at.
on List<ItemType>
Answers how many items equal the given one, or how many items the check accepts.
Equality is the items' own is. The by-value entry is available whenever the items conform to Equatable.
Returns the count.
Answers how many items equal the given one.
Equality is the items' own is. The entry is available whenever the items conform to Equatable.
ItemTypethe item to look forReturns how many items equal it, which is never negative.
Answers how many items the check accepts.
(_: ItemType) -> Booleanthe check each item is offered toReturns how many items the check accepts, which is never negative.
on List<ItemType>
Answers how many items the List has.
Returns the number of items, which is never negative.
on NonEmptyList<ItemType>
Answers how many items the List has, which is at least one.
Returns the number of items, which is above zero.
on List<ItemType>
Answers the first item, or the first item the check accepts.
The empty List has no first item, and a check can accept none of the items. The defaultingTo: entries answer the given item in place of nothing.
Answers the first item of the List.
Returns the item, or nothing for the empty List.
Answers the first item the check accepts.
(_: ItemType) -> Booleanthe check each item is offered toReturns the matching item, or nothing when no item is accepted.
Answers the first item, or the given fallback for the empty List.
ItemTypethe item to answer with when there is noneReturns the first item, or the fallback in its place.
Answers the first item the check accepts, or the given fallback when it accepts none.
(_: ItemType) -> Booleanthe check each item is offered toItemTypethe item to answer with when there is noneReturns the matching item, or the fallback in its place.
on NonEmptyList<ItemType>
Answers the first item of the List, which certainly has one.
Returns the first item.
on List<ItemType>
Answers the last item, or the last item the check accepts.
The empty List has no last item, and a check can accept none of the items. The defaultingTo: entries answer the given item in place of nothing.
Answers the last item of the List.
Returns the item, or nothing for the empty List.
Answers the last item the check accepts.
The walk runs backwards and stops at the first item it accepts.
(_: ItemType) -> Booleanthe check each item is offered toReturns the matching item, or nothing when no item is accepted.
Answers the last item, or the given fallback for the empty List.
ItemTypethe item to answer with when there is noneReturns the last item, or the fallback in its place.
Answers the last item the check accepts, or the given fallback when it accepts none.
(_: ItemType) -> Booleanthe check each item is offered toItemTypethe item to answer with when there is noneReturns the matching item, or the fallback in its place.
on NonEmptyList<ItemType>
Answers the last item of the List, which certainly has one.
Returns the last item.
on List<ItemType>
Answers the item at the given position.
The position counts from zero. A negative position counts back from the end: -1 is the last item. A position outside the List answers nothing, and the defaultingTo: entry answers the given item instead.
Answers the item at the given position.
Integerthe position of the itemReturns the item, or nothing when the position is outside the List.
Answers the item at the given position, or the given fallback when the position is outside the List.
Integerthe position of the itemItemTypethe item to answer with when the position names noneReturns the item at that position, or the fallback in its place.
on List<ItemType>
Answers the positions the List has, or the positions of the items a check accepts.
The positions count from zero and stop before the length. The empty List answers no positions.
Returns the List of positions.
Answers the positions the List has, in order.
The positions count from zero and stop before the length. The empty List answers no positions. The answer is a whole List of positions: to walk the items beside their positions in one pass, use enumerate().
Returns the List of positions.
Answers the positions of the items the check accepts, in order.
The positions count from zero. A check that accepts no item answers no positions.
(_: ItemType) -> Booleanthe check each item is offered toReturns the List of positions the check accepted.
on NonEmptyList<ItemType>
Answers the positions the List has, in order.
The positions count from zero and stop before the length. The answer is a whole List of positions: to walk the items beside their positions in one pass, use enumerate().
Returns the List of positions, which is never empty.
on List<ItemType>
Answers the only item of the List.
A List of any other length has no only item, and the defaultingTo: entry answers the given item in place of nothing.
Answers the only item of the List.
Returns the item, or nothing when the List does not hold exactly one.
Answers the only item of the List, or the given fallback for a List of any other length.
ItemTypethe item to answer with when there is no only itemReturns the item, or the fallback in its place.
on List<ItemType>
Answers every item beside the position it stands at.
The position counts from zero. The empty List answers no entries.
Returns the List of Records, each holding a position under index and the item at it under item.
on NonEmptyList<ItemType>
Answers every item beside the position it stands at.
The position counts from zero.
Returns the List of Records, each holding a position under index and the item at it under item. It is never empty.
on List<ItemType>
Answers the lowest item, or the item whose key is lowest.
Ties keep the earlier item. The empty List has no such item, and the defaultingTo: entries answer the given item in place of nothing.
Answers the item whose key is lowest.
(_: ItemType) -> Keythe key the items are ordered byReturns the item, or nothing for the empty List.
Answers the item whose key is lowest, or the given fallback for the empty List.
(_: ItemType) -> Keythe key the items are ordered byItemTypethe item to answer with when there is noneReturns the item, or the fallback in its place.
Answers the lowest item.
Ties keep the earlier item. The entry is available whenever the items conform to Comparable.
Returns the item, or nothing for the empty List.
Answers the lowest item, or the given fallback for the empty List.
The entry is available whenever the items conform to Comparable.
ItemTypethe item to answer with when there is noneReturns the item, or the fallback in its place.
on NonEmptyList<ItemType>
Answers the lowest item, or the item whose key is lowest, which a non-empty List always has.
Ties keep the earlier item.
Returns the item.
Answers the item whose key is lowest, which a non-empty List always has.
Ties keep the earlier item.
(_: ItemType) -> Keythe key the items are ordered byReturns the item.
Answers the lowest item, which a non-empty List always has.
Ties keep the earlier item. The entry is available whenever the items conform to Comparable.
Returns the item.
on List<ItemType>
Answers the highest item, or the item whose key is highest.
Ties keep the earlier item. The empty List has no such item, and the defaultingTo: entries answer the given item in place of nothing.
Answers the item whose key is highest.
(_: ItemType) -> Keythe key the items are ordered byReturns the item, or nothing for the empty List.
Answers the item whose key is highest, or the given fallback for the empty List.
(_: ItemType) -> Keythe key the items are ordered byItemTypethe item to answer with when there is noneReturns the item, or the fallback in its place.
Answers the highest item.
Ties keep the earlier item. The entry is available whenever the items conform to Comparable.
Returns the item, or nothing for the empty List.
Answers the highest item, or the given fallback for the empty List.
The entry is available whenever the items conform to Comparable.
ItemTypethe item to answer with when there is noneReturns the item, or the fallback in its place.
on NonEmptyList<ItemType>
Answers the highest item, or the item whose key is highest, which a non-empty List always has.
Ties keep the earlier item.
Returns the item.
Answers the item whose key is highest, which a non-empty List always has.
Ties keep the earlier item.
(_: ItemType) -> Keythe key the items are ordered byReturns the item.
Answers the highest item, which a non-empty List always has.
Ties keep the earlier item. The entry is available whenever the items conform to Comparable.
Returns the item.
on List<ItemType>
Answers a new List of the leading items, up to the given count, or of the leading items a check accepts.
A count below one answers the empty List. A count past the length answers every item.
Returns the List of leading items, in the order they were in.
Answers a new List of the leading items, up to the given count.
A count below one answers the empty List. A count past the length answers every item.
Integerhow many leading items to keepReturns the List of leading items, in the order they were in.
Answers a new List of the leading items the check accepts.
The walk stops at the first item the check refuses, and that item is left out. A check that accepts every item answers every item.
(_: ItemType) -> Booleanthe check the leading items are offered toReturns the List up to the first refused item.
on List<ItemType>
Answers a new List of the trailing items, up to the given count, or of the trailing items a check accepts.
A count below one answers the empty List. A count past the length answers every item.
Returns the List of trailing items, in the order they were in.
Answers a new List of the trailing items, up to the given count.
A count below one answers the empty List. A count past the length reaches back past the start, where slice settles on zero, so it answers every item.
Integerhow many trailing items to keepReturns the List of trailing items, in the order they were in.
Answers a new List of the trailing items the check accepts.
The walk runs backwards and stops at the last item the check refuses, which is left out. A check that accepts every item answers every item.
(_: ItemType) -> Booleanthe check the trailing items are offered toReturns the List from after the last refused item.
on List<ItemType>
Answers a new List with the given item, or with the contents of the given List, added at the front.
Answers a new List with the given item added at the front.
The item is never dropped, so the answer certainly has something in it.
ItemTypethe item to addReturns the extended List, which is never empty.
Answers a new List with the contents of the given List added at the front.
List<ItemType>the List whose items to addReturns the extended List.
on NonEmptyList<ItemType>
Answers a new List with the contents of the given List added at the front.
List<ItemType>the List whose items to addReturns the extended List, which is never empty.
on List<ItemType>
Answers a new List with the given item, or with the contents of the given List, added at the end.
Answers a new List with the given item added at the end.
The item is never dropped, so the answer certainly has something in it.
ItemTypethe item to addReturns the extended List, which is never empty.
Answers a new List with the contents of the given List added at the end.
List<ItemType>the List whose items to addReturns the extended List.
on NonEmptyList<ItemType>
Answers a new List with the contents of the given List added at the end.
List<ItemType>the List whose items to addReturns the extended List, which is never empty.
on List<ItemType>
Answers a new List with the given item inserted before the given position.
A negative position counts back from the end, so insert(_, at -1) puts the item before the last one. A position outside the List clamps to the nearer end. The item is never dropped, so the answer certainly has something in it.
ItemTypethe item to insertIntegerthe position to insert the item beforeReturns the List with the item inserted. It is never empty.
on List<ItemType>
Answers a new List with the item at the given position replaced by a given item, or by a transform of it.
A negative position counts back from the end: -1 is the last item. A position outside the List leaves it unchanged.
Returns the List with the item replaced.
Answers a new List with the item at the given position replaced.
A negative position counts back from the end: -1 is the last item. A position outside the List leaves it unchanged.
ItemTypethe item to put at that positionIntegerthe position of the item to replaceReturns the List with the item replaced.
Answers a new List with the item at the given position replaced by what the transform answers for it.
A negative position counts back from the end: -1 is the last item. A position outside the List leaves it unchanged, and the transform is not run.
Integerthe position of the item to replace(_: ItemType) -> ItemTypethe transform the item at that position is handed toReturns the List with the item replaced.
on NonEmptyList<ItemType>
Answers a new List with the item at the given position replaced by a given item, or by a transform of it.
A negative position counts back from the end: -1 is the last item. A position outside the List leaves it unchanged. No case can empty the List.
Returns the List with the item replaced, which is never empty.
Answers a new List with the item at the given position replaced.
A negative position counts back from the end: -1 is the last item. A position outside the List leaves it unchanged. Neither case can empty the List.
ItemTypethe item to put at that positionIntegerthe position of the item to replaceReturns the List with the item replaced, which is never empty.
Answers a new List with the item at the given position replaced by what the transform answers for it.
A negative position counts back from the end: -1 is the last item. A position outside the List leaves it unchanged, and the transform is not run.
Integerthe position of the item to replace(_: ItemType) -> ItemTypethe transform the item at that position is handed toReturns the List with the item replaced, which is never empty.
on List<ItemType>
Answers the List filled up to the given length with the given item.
The filler goes at the end when no side is named. A #BothEnds side splits it between the two ends, and an odd count leaves the extra one at the end. A length at or below the one the List has answers it unchanged, so nothing is ever dropped.
Integerthe length to fill up toItemTypethe item to fill withReturns the filled List. It is the receiver where the List is already that long.
on List<ItemType>
Answers a new List without the first item, without the given number of leading items, or without the leading items a check accepts.
The answer is empty when every item is removed. A count below one removes nothing.
Returns the shortened List.
Answers a new List without the first item, or without the given number of leading items.
The answer is empty when more items are removed than the List has. A count below one removes nothing.
Integer = 1how many leading items to remove, which is one when it is left outReturns the shortened List.
Answers a new List without the leading items the check accepts.
The walk stops at the first item the check refuses, and that item and every item after it are kept. A check that accepts every item answers the empty List.
(_: ItemType) -> Booleanthe check the leading items are offered toReturns the List from the first refused item on.
on List<ItemType>
Answers a new List without the item at the given position.
The position counts from zero. A negative position counts back from the end: -1 is the last item. A position outside the List leaves it unchanged.
Integerthe position of the item to removeReturns the List without that item.
on List<ItemType>
Answers a new List without every item equal to the given one, or without every item the check accepts.
Equality is the items' own is. The by-value entry is available whenever the items conform to Equatable.
Returns the List of remaining items.
Answers a new List without every item equal to the given one.
Equality is the items' own is. The entry is available whenever the items conform to Equatable.
ItemTypethe item to removeReturns the List of remaining items.
Answers a new List without every item the check accepts.
(_: ItemType) -> Booleanthe check each item is offered toReturns the List of the items the check rejects.
Answers a new List without any item the given List holds.
Every occurrence of such an item goes, and the rest keep their order. An item of the given List that this one does not hold changes nothing. Equality is the items' own is. The entry is available whenever the items conform to Equatable.
List<ItemType>the List whose items to removeReturns the List of remaining items.
on List<ItemType>
Answers a new List without the last item, without the given number of trailing items, or without the trailing items a check accepts.
The answer is empty when every item is removed. A count below one removes nothing.
Returns the shortened List.
Answers a new List without the last item, or without the given number of trailing items.
The answer is empty when more items are removed than the List has. A count below one removes nothing.
Integer = 1how many trailing items to remove, which is one when it is left outReturns the shortened List.
Answers a new List without the trailing items the check accepts.
The walk runs backwards and stops at the last item the check refuses. That item and every item before it are kept. A check that accepts every item answers the empty List.
(_: ItemType) -> Booleanthe check the trailing items are offered toReturns the List up to the last refused item.
on List<ItemType>
Answers a new List keeping only the first occurrence of each item, or the first item met at each key.
The kept items keep the order they had. Equality is the items' own is, or the keys' own where a key is read.
Returns the List without duplicates.
Answers a new List keeping only the first occurrence of each item.
The kept items keep the order they had. Equality is the items' own is. The entry is available whenever the items conform to Equatable. The union of two Lists is append(contentsOf other)::removeDuplicates().
Returns the List without duplicates.
Answers a new List keeping only the first item met at each key.
The kept items keep the order they had. A later item whose key is already met goes, whatever the rest of it holds. Equality is the keys' own is. The entry is available whenever what the key answers conforms to Equatable.
(_: ItemType) -> Keythe key read off each itemReturns the List holding the first item met at each key.
on NonEmptyList<ItemType>
Answers a new List keeping only the first occurrence of each item, or the first item met at each key.
The kept items keep the order they had. Equality is the items' own is, or the keys' own where a key is read.
Returns the List without duplicates, which certainly has something in it.
Answers a new List keeping only the first occurrence of each item.
The kept items keep the order they had. Equality is the items' own is. The entry is available whenever the items conform to Equatable.
Returns the List without duplicates, which certainly has something in it.
Answers a new List keeping only the first item met at each key.
The kept items keep the order they had. Equality is the keys' own is. The entry is available whenever what the key answers conforms to Equatable.
(_: ItemType) -> Keythe key read off each itemReturns the List holding the first item met at each key, which certainly has something in it.
on List<ItemType>
Answers a new List with the given transform applied to every item.
(_: ItemType) -> Otherthe transform each item is handed toReturns the List of transformed items.
on NonEmptyList<ItemType>
Answers a new List with the given transform applied to every item.
(_: ItemType) -> Otherthe transform each item is handed toReturns the List of transformed items, which certainly has something in it.
on List<ItemType>
Answers the items combined into a single value, starting from the given one.
The fold runs to the end, or stops early when the combiner says to.
Returns the combined value.
Answers the items combined into a single value, starting from the given one.
Answerthe value the first combination builds on(_: Answer, _: ItemType) -> Answerthe combiner, handed the value so far and each itemReturns the combined value.
Answers the items combined into a single value, starting from the given one, and can stop before the end.
The step combiner answers with a Step: #Continue carries the value forward, and #Done finishes at once with its own value. Both of that Step's Type Parameters are the Answer here, so a fold stops with the Type it carries. The empty List answers the starting value untouched.
Answerthe value the first combination builds on(_: Answer, _: ItemType) -> Step<Answer, Answer>the combiner, handed the value so far and each item, answering with a StepReturns the combined value, or the value the first #Done carries.
on NonEmptyList<ItemType>
Answers the items combined into a single value, with no starting value to give.
The first item opens the fold and each item after it is combined into what came before. A List of one item answers that item, and the combiner is not run.
(_: ItemType, _: ItemType) -> ItemTypethe combiner, handed the value so far and each itemReturns the combined value.
on List<ItemType>
Answers a new List of every item the check accepts, or of every item another List holds too.
The kept items keep their order.
Returns the List of kept items.
Answers a new List of every item the check accepts.
Each item is offered to the check, and the accepted items keep their order.
(_: ItemType) -> Booleanthe check each item is offered toReturns the List of accepted items.
Answers a new List of every item the given List holds too.
The kept items keep the order they had here, and an item kept once for every time it occurs. How many times the other List holds it is not asked. Equality is the items' own is. The entry is available whenever the items conform to Equatable.
List<ItemType>the List whose items to keepReturns the List of items both Lists hold.
on List<ItemType>
Answers every value the combiner builds, starting from the given one.
The answer opens with the starting value and holds one value for every item after it. So it is one longer than the List, and it is never empty. The empty List answers the starting value alone.
Answerthe value the first combination builds on(_: Answer, _: ItemType) -> Answerthe combiner, handed the value so far and each itemReturns the List of values, which is never empty.
on List<ItemType>
Answers every value the transform answers for an item.
The items the transform answers nothing for are left out, so the answer can be shorter than the receiver. It is map(transform)::values() in one walk.
(_: ItemType) -> Optional<Other>the transform each item is handed toReturns the List of values.
on List<ItemType>
Answers a new List with the items in the opposite order.
Returns the reversed List.
on NonEmptyList<ItemType>
Answers a new List with the items in the opposite order.
Returns the reversed List, which certainly has something in it.
on List<ItemType>
Answers a new List in order, by the items' own ordering, by the given comparison, or by a key.
The sort is stable, so items the order does not tell apart keep the order they had, in either direction. The first entry is available whenever the items conform to Comparable.
A direction is read where one is taken, and it is #Ascending when a call names none.
Returns the ordered List.
Answers a new List in the given direction, by the items' own ordering.
The sort is stable. The entry is available whenever the items conform to Comparable. The direction is #Ascending when a call names none. For any other order, use the by: entry.
Returns the ordered List.
Answers a new List ordered by the given comparison, applied to each pair of items.
The sort is stable.
(_: ItemType, _: ItemType) -> Orderingthe comparison to order the items withReturns the ordered List.
Answers a new List in the given direction of what the key reads off each item.
The key is read once per item. The sort is stable, so items whose keys compare equal keep the order they had. The entry is available whenever what the key answers conforms to Comparable. The direction is #Ascending when a call names none.
(_: ItemType) -> Keythe key each item is ordered byReturns the ordered List.
on NonEmptyList<ItemType>
Answers a new List in order, by the items' own ordering, by the given comparison, or by a key.
The sort is stable, so items the order does not tell apart keep the order they had, in either direction. The first entry is available whenever the items conform to Comparable.
A direction is read where one is taken, and it is #Ascending when a call names none.
Returns the ordered List, which certainly has something in it.
Answers a new List in the given direction, by the items' own ordering.
The sort is stable. The entry is available whenever the items conform to Comparable. The direction is #Ascending when a call names none. For any other order, use the by: entry.
Returns the ordered List, which certainly has something in it.
Answers a new List ordered by the given comparison, applied to each pair of items.
The sort is stable.
(_: ItemType, _: ItemType) -> Orderingthe comparison to order the items withReturns the ordered List, which certainly has something in it.
Answers a new List in the given direction of what the key reads off each item.
The key is read once per item. The sort is stable, so items whose keys compare equal keep the order they had. The entry is available whenever what the key answers conforms to Comparable. The direction is #Ascending when a call names none.
(_: ItemType) -> Keythe key each item is ordered byReturns the ordered List, which certainly has something in it.
on List<ItemType>
Answers a new List of the items from one position up to, but not including, another.
A negative position counts back from the end, so slice(from 0, to -1) drops the last item.
Integer = 0the first position to include, counting from zero, or back from the end when negative. It is zero when the call leaves it out.Integer = @::length()the position to stop before, counting the same way. It is the length when the call leaves it out.Returns the List of items in that range. It is empty when the range is empty, inverted, or entirely outside the List.
on List<ItemType>
Answers the List split in two: by a check, at the end of the leading run a check accepts, or at a position.
Both halves keep the original order, and every item of the receiver is in exactly one of them.
Returns a Record holding the two halves.
Answers the List split in two by the check: the items it accepts, and the items it refuses.
Both halves keep the original order. Each item is offered to the check once.
(_: ItemType) -> Booleanthe check each item is offered toReturns a Record holding the accepted items under accepted and the others under refused.
Answers the List split at the end of the leading run the check accepts.
The walk stops at the first item the check refuses. That item opens the trailing half. A check that accepts every item answers the whole List under leading.
(_: ItemType) -> Booleanthe check the leading items are offered toReturns a Record holding the leading run under leading and the rest under trailing.
Answers the List split in two at the given position.
The item at that position opens the trailing half. A negative position counts back from the end: -1 cuts before the last item. A position outside the List leaves one half empty.
Integerthe position to cut beforeReturns a Record holding the items before that position under leading and the rest under trailing.
on List<Result<ValueType, FailureType>>
Answers the Results split in two: the values they hold, and the reasons they failed with.
Both halves keep the original order. Every item of the receiver is in exactly one of them.
Returns a Record holding the values under values and the reasons under reasons.
on List<ItemType>
Answers the List split into groups of a given size, or into the pieces around the items a separator or a check picks out.
Returns the List of pieces.
Answers the List split into groups of the given size, in order.
The last group holds whatever remains, so it can be shorter. Every group holds at least one item. A size below one names no grouping, and the answer is one group holding every item. The empty List answers no groups at all, whatever the size.
Integerhow many items each group holdsReturns the List of groups, each of which certainly has something in it.
Answers the pieces around every item equal to the given one.
The separators are not in the answer. Two separators next to each other leave the empty piece between them, and a separator at an end leaves one there. Equality is the items' own is. The entry is available whenever the items conform to Equatable.
ItemTypethe item to split atReturns the List of pieces, which always holds at least one.
Answers the pieces around every item the check accepts.
The accepted items are not in the answer. Two accepted items next to each other leave the empty piece between them, and one at an end leaves one there. The empty List answers one empty piece.
(_: ItemType) -> Booleanthe check each item is offered toReturns the List of pieces, which always holds at least one.
on NonEmptyList<ItemType>
Answers the List split into groups of the given size, in order.
The last group holds whatever remains, so it can be shorter. A size below one names no grouping, and the answer is one group holding every item.
Integerhow many items each group holdsReturns the List of groups, which certainly has one, and each group certainly has an item.
on List<ItemType>
Answers every stretch of the given size, one position at a time.
The stretches overlap: each starts one position after the one before it. A size above the length answers no stretches at all, and so does the empty List. Every stretch holds the given number of items. For the pairs of neighbours alone, list::pair(with list::removeFirst()) answers a Record of first and second per pair and reads better.
Returns the List of stretches, each of which certainly has something in it.
on List<ItemType>
Answers the stretches of neighbouring items the check accepts.
A stretch ends at the first item the check refuses, and the refused items are in no stretch. Every stretch holds at least one item. A List the check accepts no item of answers no stretches, and so does the empty List.
(_: ItemType) -> Booleanthe check each item is offered toReturns the List of stretches, each of which certainly has something in it.
on List<ItemType>
Answers the items joined into one String, with the given separator between them.
Each item is rendered by its own toString: [1, 2, 3]::join(with ", ") is "1, 2, 3". The answer is the raw text, so a String item is not quoted, which is where joining differs from toString. For a List of Strings the Method undoes String::split(on:). It is available whenever the items conform to Printable.
Stringthe separator to place between the itemsReturns the joined String. The empty List answers the empty String.
on List<ItemType>
Answers the items of the two Lists paired position by position.
The pairing stops with the shorter List.
List<Other>the List to pair the items withReturns a List of Records, each holding one item of this List under first and its counterpart under second.
on NonEmptyList<ItemType>
Answers the items of the two Lists paired position by position.
The pairing stops with the shorter List, which certainly has something in it.
Returns a List of Records, each holding one item of this List under first and its counterpart under second. It is never empty.
on List<List<ItemType>>
Answers the inner Lists flattened by one level, into a single List.
Every inner List's items keep their order.
Returns the flattened List.
on NonEmptyList<NonEmptyList<ItemType>>
Answers the inner Lists flattened by one level, into a single List.
Every inner List's items keep their order.
Returns the flattened List, which certainly has something in it.
on List<List<ItemType>>
Answers the inner Lists turned round: one List per position, holding what each inner List has there.
The shortest inner List decides how many the answer holds, as pair(with:) does. An empty inner List answers no Lists at all, and so does the empty List of Lists. Transposing twice answers the receiver where every inner List is the same length.
Returns the List of positions, each holding one item of every inner List.
on List<Optional<ItemType>>
Answers the values the Optionals hold, in order.
The empty Optionals are left out, so the answer can be shorter than the receiver. A List of empty Optionals answers the empty List. Where one empty Optional has to answer nothing at all, the Method is allValues().
Returns the List of values.
on List<Result<ValueType, FailureType>>
Answers the values the Results hold, in order.
The failed Results are left out, so the answer can be shorter than the receiver. A List of failed Results answers the empty List. Where one failure has to answer nothing at all, the Method is allValues().
Returns the List of values.
on List<Optional<ItemType>>
Answers every value in order, and nothing where an Optional is empty.
The answer holds one value for every item of the receiver. The empty List answers the empty List, held in an Optional.
Returns the List of every value, or an empty Optional.
on List<Result<ValueType, FailureType>>
Answers every value in order, and every reason where anything failed.
The answer holds one value for every item of the receiver. A single failure decides the answer, and the reasons are kept in the order they stand in. The empty List answers the empty List, held in a value. Where only the first reason is wanted, reason()::map((reasons) { <- reasons::firstItem() }) reads it.
Returns every value in a Result, or every reason in one.
on List<Optional<ItemType>>
Answers the value of the first Optional that holds one.
The walk stops at that Optional. A List holding nothing but empty Optionals answers empty, and so does the empty List.
Returns the first value, or an empty Optional.
on List<Result<ValueType, FailureType>>
Answers the reasons the failed Results hold, in order.
The Results holding a value are left out. A List of values answers the empty List.
Returns the List of reasons.
partition on List<Result<ValueType, FailureType>> is listed under partition, with the other entries of that name.
on List<ItemType>
Answers the items grouped under the key the given Function reads off each one.
The groups stand in the order their keys first appear, and the items of a group keep the order they had. Every group holds at least one item, and the empty List answers the empty Dictionary. Equality is the keys' own is. The List of groups is what entries() answers: one Record per group, holding the key and its items under value.
(_: ItemType) -> Keythe key read off each itemReturns the Dictionary of groups, each of which has an item in it.
on NonEmptyList<ItemType>
Answers the items grouped under the key the given Function reads off each one.
The groups stand in the order their keys first appear, and the items of a group keep the order they had. Every group holds at least one item. Equality is the keys' own is.
(_: ItemType) -> Keythe key read off each itemReturns the Dictionary of groups, which certainly has a group in it.
on List<ItemType>
Answers how many times each item occurs.
The items stand in the order they first appear. Equality is the items' own is.
Returns the Dictionary of counts, each of which is above zero.
on NonEmptyList<ItemType>
Answers how many times each item occurs.
The items stand in the order they first appear. Equality is the items' own is.
Returns the Dictionary of counts, which certainly has a count in it.
on List<ItemType>
Answers the items under the key the given Function reads off each one, one item per key.
A later item with the same key replaces the earlier one as the value. The key keeps the place it was first met at, as set does. The keys stand in the order they first appear. Equality is the keys' own is. To keep every item under a key, use group(on:).
(_: ItemType) -> Keythe key read off each itemReturns the Dictionary of items, keyed by what the Function read off each.
on NonEmptyList<ItemType>
Answers the items under the key the given Function reads off each one, one item per key.
A later item with the same key replaces the earlier one as the value. The key keeps the place it was first met at, as set does. The keys stand in the order they first appear. Equality is the keys' own is.
(_: ItemType) -> Keythe key read off each itemReturns the Dictionary of items, which certainly has an entry in it.
on List<Integer>
Adds every item together.
The empty List totals zero.
Returns the total.
on List<Rational>
Adds every item together.
The empty List totals zero.
Returns the total.
on List<Scalar>
Adds every item together.
The empty List totals zero. A whole total answers as an Integer, and a fractional one as a Rational.
Returns the total.
on List<ItemType>
Adds together what the key reads off every item.
The empty List totals zero.
Returns the total.
Adds together the Integers the key reads off the items.
(_: ItemType) -> Integerthe key read off each itemReturns the total.
Adds together the Rationals the key reads off the items.
(_: ItemType) -> Rationalthe key read off each itemReturns the total.
Adds together the Numbers the key reads off the items.
A whole total answers as an Integer, and a fractional one as a Rational.
(_: ItemType) -> Scalarthe key read off each itemReturns the total.
on List<Integer>
Multiplies every item together.
The empty List answers one.
Returns the product.
on List<Rational>
Multiplies every item together.
The empty List answers one.
Returns the product.
on List<Scalar>
Multiplies every item together.
The empty List answers one. A whole product answers as an Integer, and a fractional one as a Rational.
Returns the product.
on List<ItemType>
Multiplies together what the key reads off every item.
The empty List answers one.
Returns the product.
Multiplies together the Integers the key reads off the items.
(_: ItemType) -> Integerthe key read off each itemReturns the product.
Multiplies together the Rationals the key reads off the items.
(_: ItemType) -> Rationalthe key read off each itemReturns the product.
Multiplies together the Numbers the key reads off the items.
A whole product answers as an Integer, and a fractional one as a Rational.
(_: ItemType) -> Scalarthe key read off each itemReturns the product.
on List<Integer>
Every total the items build, one after another.
The answer opens with zero and holds one total for every item after it. So it is one longer than the List, and it is never empty. The last total is what sum answers.
Returns the List of totals, which is never empty.
on List<Rational>
Every total the items build, one after another.
The answer opens with zero and holds one total for every item after it. So it is one longer than the List, and it is never empty. The last total is what sum answers.
Returns the List of totals, which is never empty.
on List<Scalar>
Every total the items build, one after another.
The answer opens with zero and holds one total for every item after it. So it is one longer than the List, and it is never empty. A total stays a Rational once a Rational has been added to it, where sum collapses a whole total to an Integer.
Returns the List of totals, which is never empty.
on List<Integer>
The mean of the items: their total divided by their count.
The empty List has no mean, and the defaultingTo: entry answers the given Rational in place of nothing.
The mean of the items.
Returns the mean, or nothing for the empty List.
The mean of the items, or the given fallback for the empty List.
Rationalthe mean to answer with when there is noneReturns the mean, or the fallback in its place.
on List<Rational>
The mean of the items: their total divided by their count.
The empty List has no mean, and the defaultingTo: entry answers the given Rational in place of nothing.
The mean of the items.
Returns the mean, or nothing for the empty List.
The mean of the items, or the given fallback for the empty List.
Rationalthe mean to answer with when there is noneReturns the mean, or the fallback in its place.
on List<Scalar>
The mean of the items: their total divided by their count.
The empty List has no mean, and the defaultingTo: entry answers the given Rational in place of nothing.
The mean of the items.
Returns the mean, or nothing for the empty List.
The mean of the items, or the given fallback for the empty List.
Rationalthe mean to answer with when there is noneReturns the mean, or the fallback in its place.
on List<ItemType>
The mean of what the key reads off every item: their total divided by their count.
The empty List has no mean, and the defaultingTo: entry answers the given Rational in place of nothing.
The mean of what the key reads off the items.
(_: ItemType) -> Scalarthe key read off each itemReturns the mean, or nothing for the empty List.
The mean of what the key reads off the items, or the given fallback for the empty List.
(_: ItemType) -> Scalarthe key read off each itemRationalthe mean to answer with when there is noneReturns the mean, or the fallback in its place.
on NonEmptyList<Integer>
The mean of the items: their total divided by their count.
Returns the mean.
on NonEmptyList<Rational>
The mean of the items: their total divided by their count.
Returns the mean.
on NonEmptyList<Scalar>
The mean of the items: their total divided by their count.
Returns the mean.
on NonEmptyList<ItemType>
The mean of what the key reads off every item: their total divided by their count.
The List has an item, so the answer is the mean itself rather than an Optional.
(_: ItemType) -> Scalarthe key read off each itemReturns the mean.
on List<Integer>
The lowest item.
The empty List has no lowest item, and the defaultingTo: entry answers the given item in place of nothing.
The lowest item.
Returns the lowest item, or nothing for the empty List.
The lowest item, or the given fallback for the empty List.
Integerthe item to answer with when there is noneReturns the lowest item, or the fallback in its place.
on List<Rational>
The lowest item.
The empty List has no lowest item, and the defaultingTo: entry answers the given item in place of nothing.
The lowest item.
Returns the lowest item, or nothing for the empty List.
The lowest item, or the given fallback for the empty List.
Rationalthe item to answer with when there is noneReturns the lowest item, or the fallback in its place.
on List<Scalar>
The lowest item.
The empty List has no lowest item, and the defaultingTo: entry answers the given item in place of nothing.
The lowest item.
Returns the lowest item, or nothing for the empty List.
The lowest item, or the given fallback for the empty List.
Scalarthe item to answer with when there is noneReturns the lowest item, or the fallback in its place.
on NonEmptyList<Integer>
The lowest item, which a non-empty List always has.
Returns the lowest item.
on NonEmptyList<Rational>
The lowest item, which a non-empty List always has.
Returns the lowest item.
on NonEmptyList<Scalar>
The lowest item, which a non-empty List always has.
Returns the lowest item.
on List<Integer>
The highest item.
The empty List has no highest item, and the defaultingTo: entry answers the given item in place of nothing.
The highest item.
Returns the highest item, or nothing for the empty List.
The highest item, or the given fallback for the empty List.
Integerthe item to answer with when there is noneReturns the highest item, or the fallback in its place.
on List<Rational>
The highest item.
The empty List has no highest item, and the defaultingTo: entry answers the given item in place of nothing.
The highest item.
Returns the highest item, or nothing for the empty List.
The highest item, or the given fallback for the empty List.
Rationalthe item to answer with when there is noneReturns the highest item, or the fallback in its place.
on List<Scalar>
The highest item.
The empty List has no highest item, and the defaultingTo: entry answers the given item in place of nothing.
The highest item.
Returns the highest item, or nothing for the empty List.
The highest item, or the given fallback for the empty List.
Scalarthe item to answer with when there is noneReturns the highest item, or the fallback in its place.
on NonEmptyList<Integer>
The highest item, which a non-empty List always has.
Returns the highest item.
on NonEmptyList<Rational>
The highest item, which a non-empty List always has.
Returns the highest item.
on NonEmptyList<Scalar>
The highest item, which a non-empty List always has.
Returns the highest item.
on List<Integer>
The middle item, once the items are put in order.
A count that is even has two middle items, and the answer is their mean. The empty List has no median, and the defaultingTo: entry answers the given Rational in place of nothing.
The median of the items.
Returns the median, or nothing for the empty List.
The median of the items, or the given fallback for the empty List.
Rationalthe median to answer with when there is noneReturns the median, or the fallback in its place.
on List<Rational>
The middle item, once the items are put in order.
A count that is even has two middle items, and the answer is their mean. The empty List has no median, and the defaultingTo: entry answers the given Rational in place of nothing.
The median of the items.
Returns the median, or nothing for the empty List.
The median of the items, or the given fallback for the empty List.
Rationalthe median to answer with when there is noneReturns the median, or the fallback in its place.
on List<Scalar>
The middle item, once the items are put in order.
A count that is even has two middle items, and the answer is their mean. The empty List has no median, and the defaultingTo: entry answers the given Rational in place of nothing.
The median of the items.
Returns the median, or nothing for the empty List.
The median of the items, or the given fallback for the empty List.
Rationalthe median to answer with when there is noneReturns the median, or the fallback in its place.
on NonEmptyList<Integer>
The middle item, once the items are put in order.
A count that is even has two middle items, and the answer is their mean.
Returns the median.
on NonEmptyList<Rational>
The middle item, once the items are put in order.
A count that is even has two middle items, and the answer is their mean.
Returns the median.
on NonEmptyList<Scalar>
The middle item, once the items are put in order.
A count that is even has two middle items, and the answer is their mean.
Returns the median.
on List<Integer>
The value at the given position through the items, once they are put in order.
A position between two items answers the point between those items, in proportion. The fraction is clamped between zero and one. The empty List has no such value, and the defaultingTo: entry answers the given Rational in place of nothing.
The value at the given position through the items.
Rationalthe position through the items, from zero to oneReturns the value, or nothing for the empty List.
The value at the given position, or the given fallback for the empty List.
Rationalthe position through the items, from zero to oneRationalthe value to answer with when there is noneReturns the value, or the fallback in its place.
on List<Rational>
The value at the given position through the items, once they are put in order.
A position between two items answers the point between those items, in proportion. The fraction is clamped between zero and one. The empty List has no such value, and the defaultingTo: entry answers the given Rational in place of nothing.
The value at the given position through the items.
Rationalthe position through the items, from zero to oneReturns the value, or nothing for the empty List.
The value at the given position, or the given fallback for the empty List.
Rationalthe position through the items, from zero to oneRationalthe value to answer with when there is noneReturns the value, or the fallback in its place.
on List<Scalar>
The value at the given position through the items, once they are put in order.
A position between two items answers the point between those items, in proportion. The fraction is clamped between zero and one. The empty List has no such value, and the defaultingTo: entry answers the given Rational in place of nothing.
The value at the given position through the items.
Rationalthe position through the items, from zero to oneReturns the value, or nothing for the empty List.
The value at the given position, or the given fallback for the empty List.
Rationalthe position through the items, from zero to oneRationalthe value to answer with when there is noneReturns the value, or the fallback in its place.
on NonEmptyList<Integer>
The value at the given position through the items, once they are put in order.
A position between two items answers the point between those items, in proportion. The fraction is clamped between zero and one.
Rationalthe position through the items, from zero to oneReturns the value at that position.
on NonEmptyList<Rational>
The value at the given position through the items, once they are put in order.
A position between two items answers the point between those items, in proportion. The fraction is clamped between zero and one.
Rationalthe position through the items, from zero to oneReturns the value at that position.
on NonEmptyList<Scalar>
The value at the given position through the items, once they are put in order.
A position between two items answers the point between those items, in proportion. The fraction is clamped between zero and one.
Rationalthe position through the items, from zero to oneReturns the value at that position.
on List<Integer>
The item that occurs most often.
Items occurring equally often keep the earlier one, by where each first stands. The empty List has no such item, and the defaultingTo: entry answers the given item in place of nothing.
The item that occurs most often.
Returns the item, or nothing for the empty List.
The item that occurs most often, or the given fallback for the empty List.
Integerthe item to answer with when there is noneReturns the item, or the fallback in its place.
on List<Rational>
The item that occurs most often.
Items occurring equally often keep the earlier one, by where each first stands. The empty List has no such item, and the defaultingTo: entry answers the given item in place of nothing.
The item that occurs most often.
Returns the item, or nothing for the empty List.
The item that occurs most often, or the given fallback for the empty List.
Rationalthe item to answer with when there is noneReturns the item, or the fallback in its place.
on List<Scalar>
The item that occurs most often.
Items occurring equally often keep the earlier one, by where each first stands. The empty List has no such item, and the defaultingTo: entry answers the given item in place of nothing.
The item that occurs most often.
Returns the item, or nothing for the empty List.
The item that occurs most often, or the given fallback for the empty List.
Scalarthe item to answer with when there is noneReturns the item, or the fallback in its place.
on NonEmptyList<Integer>
The item that occurs most often.
Items occurring equally often keep the earlier one, by where each first stands.
Returns the item that occurs most often.
on NonEmptyList<Rational>
The item that occurs most often.
Items occurring equally often keep the earlier one, by where each first stands.
Returns the item that occurs most often.
on NonEmptyList<Scalar>
The item that occurs most often.
Items occurring equally often keep the earlier one, by where each first stands.
Returns the item that occurs most often.
on List<Integer>
The mean of the squared distances from the mean.
The count divides, so the answer is the variance of the items as a whole population. The empty List has no variance, and the defaultingTo: entry answers the given Rational in place of nothing.
The variance of the items.
Returns the variance, which is never negative, or nothing for the empty List.
The variance of the items, or the given fallback for the empty List.
Returns the variance, or the fallback in its place.
on List<Rational>
The mean of the squared distances from the mean.
The count divides, so the answer is the variance of the items as a whole population. The empty List has no variance, and the defaultingTo: entry answers the given Rational in place of nothing.
The variance of the items.
Returns the variance, which is never negative, or nothing for the empty List.
The variance of the items, or the given fallback for the empty List.
Returns the variance, or the fallback in its place.
on List<Scalar>
The mean of the squared distances from the mean.
The count divides, so the answer is the variance of the items as a whole population. The empty List has no variance, and the defaultingTo: entry answers the given Rational in place of nothing.
The variance of the items.
Returns the variance, which is never negative, or nothing for the empty List.
The variance of the items, or the given fallback for the empty List.
Returns the variance, or the fallback in its place.
on NonEmptyList<Integer>
The mean of the squared distances from the mean.
The count divides, so the answer is the variance of the items as a whole population.
Returns the variance, which is never negative.
on NonEmptyList<Rational>
The mean of the squared distances from the mean.
The count divides, so the answer is the variance of the items as a whole population.
Returns the variance, which is never negative.
on NonEmptyList<Scalar>
The mean of the squared distances from the mean.
The count divides, so the answer is the variance of the items as a whole population.
Returns the variance, which is never negative.
on List<Integer>
The square root of the variance.
A variance that is a ratio of two perfect squares answers a Rational, and every other variance answers an exact Algebraic. The empty List has none, and the defaultingTo: entry answers the given value in place of nothing.
The standard deviation of the items.
Returns the standard deviation, or nothing for the empty List.
The standard deviation of the items, or the given fallback for the empty List.
Rational | Algebraicthe value to answer with when there is noneReturns the standard deviation, or the fallback in its place.
on List<Rational>
The square root of the variance.
A variance that is a ratio of two perfect squares answers a Rational, and every other variance answers an exact Algebraic. The empty List has none, and the defaultingTo: entry answers the given value in place of nothing.
The standard deviation of the items.
Returns the standard deviation, or nothing for the empty List.
The standard deviation of the items, or the given fallback for the empty List.
Rational | Algebraicthe value to answer with when there is noneReturns the standard deviation, or the fallback in its place.
on List<Scalar>
The square root of the variance.
A variance that is a ratio of two perfect squares answers a Rational, and every other variance answers an exact Algebraic. The empty List has none, and the defaultingTo: entry answers the given value in place of nothing.
The standard deviation of the items.
Returns the standard deviation, or nothing for the empty List.
The standard deviation of the items, or the given fallback for the empty List.
Rational | Algebraicthe value to answer with when there is noneReturns the standard deviation, or the fallback in its place.
on NonEmptyList<Integer>
The square root of the variance.
A variance that is a ratio of two perfect squares answers a Rational, and every other variance answers an exact Algebraic.
Returns the standard deviation.
on NonEmptyList<Rational>
The square root of the variance.
A variance that is a ratio of two perfect squares answers a Rational, and every other variance answers an exact Algebraic.
Returns the standard deviation.
on NonEmptyList<Scalar>
The square root of the variance.
A variance that is a ratio of two perfect squares answers a Rational, and every other variance answers an exact Algebraic.
Returns the standard deviation.
Each type below is a checked refinement: a type with a condition. A value has the type only once the compiler knows the condition holds, and Checked refinements shows how it finds out. Under each one, Tighter here lists the methods above that return a more precise type when called on it. Returned by lists the methods that return it.
A List proven to have an item in it, as a checked refinement of List.
The proof is what lets firstItem and lastItem answer an item rather than an Optional. A List written down with items in it carries the proof. A List a Program is handed earns it through an if asking hasItems.
append(_:), prepend(_:) and insert(_:at:) each put something into what they were given, so each answers with this Type. The of(integersFrom:downTo:) entry answers it too, because a count down always answers its first value.
Tighter here length, firstItem, lastItem, indices, enumerate, lowestItem, highestItem, prepend, append, replace, removeDuplicates, map, reduce, reverse, sort, split, pair, flatten, group, tally, index, average, lowestNumber, highestNumber, median, percentile, mode, variance, standardDeviation
Returned by NonEmptyDictionary::keys(), NonEmptyDictionary::values(), NonEmptyDictionary::entries(), GroupedList::group(on:), GroupedNonEmptyList::group(on:), List.repeat(_:times:), List.of(integersFrom:downTo:), List.of(integersFrom:downTo:by:), List::prepend(_:), List::append(_:), List::insert(_:at:), List::split(intoGroupsOf:), List::split(on:), List::split(where:), List::accumulate(startingWith:_:), List::windows(of:), List::runs(where:), ResultList::allValues(), NonEmptyList::indices(), NonEmptyList::enumerate(), NonEmptyList::prepend(contentsOf:), NonEmptyList::append(contentsOf:), NonEmptyList::map(_:), NonEmptyList::reverse(), NonEmptyList::sort(in:), NonEmptyList::sort(by:), NonEmptyList::sort(on:in:), NonEmptyList::replace(_:at:), NonEmptyList::replace(at:_:), NonEmptyList::pair(with:), NonEmptyList::split(intoGroupsOf:), NonEmptyList::removeDuplicates(), NonEmptyList::removeDuplicates(on:), NonEmptyNestedList::flatten(), IntegerList::runningTotal(), RationalList::runningTotal(), NumberList::runningTotal(), Randomness::pick(_:from:), Randomness::shuffle(_:), String::lines(), String::split(on:), String::split(on:atMost:), NonEmptyString::characters()
Each mode below is a choice whose cases carry no payload. You pass one to a method to choose how the method works. Every mode has is, isNot and toString, and cases() on its name lists its cases, as in SortOrder.cases(). None of them is written out for a mode: Protocols says where each one comes from.
Which way sort runs: #Ascending from the lowest, or #Descending from the highest.
#Ascending is what a call that names no order gets. Descending is not a sort followed by a reverse. The comparison is turned around instead, so items the order does not tell apart keep the order they had.
Cases #Ascending, #Descending
Taken by
Dictionary::sort(in:), default #AscendingDictionary::sort(on:in:), default #AscendingNonEmptyDictionary::sort(in:), default #AscendingNonEmptyDictionary::sort(on:in:), default #AscendingList::isSorted(in:), default #AscendingList::sort(in:), default #AscendingList::sort(on:in:), default #AscendingNonEmptyList::sort(in:), default #AscendingNonEmptyList::sort(on:in:), default #Ascending