-
Notifications
You must be signed in to change notification settings - Fork 76
Documentation and tests for the first and firstOrNull functions
#1547
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
base: master
Are you sure you want to change the base?
Conversation
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/first.kt
Outdated
Show resolved
Hide resolved
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/first.kt
Outdated
Show resolved
Hide resolved
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/first.kt
Outdated
Show resolved
Hide resolved
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/first.kt
Outdated
Show resolved
Hide resolved
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/first.kt
Outdated
Show resolved
Hide resolved
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/first.kt
Outdated
Show resolved
Hide resolved
AndreiKingsley
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job!
Regarding overloads for GroupBy and Pivot - I'm working on a general KDoc system for these operations, so I'll be reworking them anyway in the future, so you can leave them as they are.
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/first.kt
Outdated
Show resolved
Hide resolved
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/first.kt
Outdated
Show resolved
Hide resolved
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/first.kt
Outdated
Show resolved
Hide resolved
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/first.kt
Outdated
Show resolved
Hide resolved
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/first.kt
Outdated
Show resolved
Hide resolved
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/first.kt
Outdated
Show resolved
Hide resolved
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/first.kt
Outdated
Show resolved
Hide resolved
core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/first.kt
Outdated
Show resolved
Hide resolved
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/first.kt
Outdated
Show resolved
Hide resolved
| * @throws [NoSuchElementException] if the [DataColumn] contains no element matching the [predicate] | ||
| * (including the case when the [DataColumn] is empty). | ||
| */ | ||
| public fun <T> DataColumn<T>.first(predicate: (T) -> Boolean): T = values.first(predicate) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason we do not make this function inline? last in the same case is inline (the same goes for DataColumn<T>.firstOrNull(predicate: (T) -> Boolean))
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/first.kt
Outdated
Show resolved
Hide resolved
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/first.kt
Outdated
Show resolved
Hide resolved
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/first.kt
Outdated
Show resolved
Hide resolved
6e10c71 to
803c080
Compare
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/first.kt
Outdated
Show resolved
Hide resolved
803c080 to
f3b0fb1
Compare
f3b0fb1 to
eed2863
Compare
| /** | ||
| * Returns the first [row][DataRow] in this [DataFrame]. | ||
| * | ||
| * @see [DataFrame.firstOrNull] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you actually need to provide receiver here?
Anyway, please, omit it. Just [firstOrNull] should work, but if not, please use
[firstOrNull][DataFrame.firstOrNull]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do it in all other place, please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We discussed it here: #1547 (comment)
@see [firstOrNull][DataFrame.firstOrNull] still leads to showing the whole thing: DataFrame.firstOrNull.
But I think we can also do it in this style:
See [lastOrNull][DataFrame.lastOrNull],
[first][DataFrame.first],
[take][DataFrame.take],
[takeLast][DataFrame.takeLast],
[takeWhile][DataFrame.takeWhile]

Fixes #1279