8000 fix #515 seq method lengthCompare now said to take Int by bjornregnell · Pull Request #517 · scala/docs.scala-lang · GitHub
[go: up one dir, main page]

Skip to content

fix #515 seq method lengthCompare now said to take Int #517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix doc of seq method lengthCompare to take Int
  • Loading branch information
bjornregnell committed Apr 8, 2016
commit 2624c305a8a6f24ea3398fe0fcbd0c72492bdd12
4 changes: 2 additions & 2 deletions overviews/collections/seqs.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The [Seq](http://www.scala-lang.org/api 7C0D /current/scala/collection/Seq.html) trait

The operations on sequences, summarized in the table below, fall into the following categories:

* **Indexing and length** operations `apply`, `isDefinedAt`, `length`, `indices`, and `lengthCompare`. For a `Seq`, the `apply` operation means indexing; hence a sequence of type `Seq[T]` is a partial function that takes an `Int` argument (an index) and which yields a sequence element of type `T`. In other words `Seq[T]` extends `PartialFunction[Int, T]`. The elements of a sequence are indexed from zero up to the `length` of the sequence minus one. The `length` method on sequences is an alias of the `size` method of general collections. The `lengthCompare` method allows you to compare the lengths of two sequences even if one of the sequences has infinite length.
* **Indexing and length** operations `apply`, `isDefinedAt`, `length`, `indices`, and `lengthCompare`. For a `Seq`, the `apply` operation means indexing; hence a sequence of type `Seq[T]` is a partial function that takes an `Int` argument (an index) and which yields a sequence element of type `T`. In other words `Seq[T]` extends `PartialFunction[Int, T]`. The elements of a sequence are indexed from zero up to the `length` of the sequence minus one. The `length` method on sequences is an alias of the `size` method of general collections. The `lengthCompare` method allows you to compare the lengths of a sequences with an Int even if the sequences has infinite length.
* **Index search operations** `indexOf`, `lastIndexOf`, `indexOfSlice`, `lastIndexOfSlice`, `indexWhere`, `lastIndexWhere`, `segmentLength`, `prefixLength`, which return the index of an element equal to a given value or matching some predicate.
* **Addition operations** `+:`, `:+`, `padTo`, which return new sequences obtained by adding elements at the front or the end of a sequence.
* **Update operations** `updated`, `patch`, which return a new sequence obtained by replacing some elements of the original sequence.
Expand All @@ -32,7 +32,7 @@ If a sequence is mutable, it offers in addition a side-effecting `update` method
| `xs(i)` |(or, written out, `xs apply i`). The element of `xs` at index `i`.|
| `xs isDefinedAt i` |Tests whether `i` is contained in `xs.indices`.|
| `xs.length` |The length of the sequence (same as `size`).|
| `xs.lengthCompare ys` |Returns `-1` if `xs` is shorter than `ys`, `+1` if it is longer, and `0` is they have the same length. Works even if one if the sequences is infinite.|
| `xs lengthCompare n` |Returns `-1` if `xs` is shorter than `n`, `+1` if it is longer, and `0` if it is of length `n`. Works even if the sequence is infinite, for example `Stream.from(1) lengthCompare 42` equals `+1`.|
| `xs.indices` |The index range of `xs`, extending from `0` to `xs.length - 1`.|
| **Index Search:** | |
| `xs indexOf x` |The index of the first element in `xs` equal to `x` (several variants exist).|
Expand Down
0