Skip to content

Commit

Permalink
Add list.indexes(…)
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasWanke committed Dec 12, 2024
1 parent c9e83be commit 4b79ede
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages_v5/example.candy
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,9 @@ fun getRange[T](list: List[T], startInclusive: Int, endExclusive: Int) List[T] {
),
}
}
fun indexes[T](list: List[T]) List[Int] {
listGenerate(list.length(), (i: Int) { i })
}

# TODO: .firstIndexWhere(…), .firstWhere(…), .firstIndexOf(…), .lastIndexWhere(…), .lastWhere(…), .lastIndexOf(…)
fun print[T: ToText](t: T) {
Expand Down

0 comments on commit 4b79ede

Please sign in to comment.