feat: add Sequence.list method to convert any sequence into a List
Implements a new `list` method on the Sequence class that iterates over all elements and collects them into a new List instance. Includes documentation in the core sequence docs and a test case verifying correct behavior with a custom sequence implementation.
This commit is contained in:
@@ -90,6 +90,14 @@ class Sequence {
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
list {
|
||||
var result = new List
|
||||
for (element in this) {
|
||||
result.add(element)
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
class String is Sequence {}
|
||||
|
||||
Reference in New Issue
Block a user