feat: add Sequence.list method to collect elements into a new List
Implements a new `list` method on the Sequence class that iterates over all elements and returns them as a freshly created List object. Includes documentation with usage example and a test case using a custom TestSequence class to verify correct behavior.
This commit is contained in:
@@ -136,6 +136,14 @@ static const char* libSource =
|
||||
"\n"
|
||||
" return result\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" list {\n"
|
||||
" var result = new List\n"
|
||||
" for (element in this) {\n"
|
||||
" result.add(element)\n"
|
||||
" }\n"
|
||||
" return result\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"class String is Sequence {\n"
|
||||
|
||||
Reference in New Issue
Block a user