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:
Thorbjørn Lindeijer
2015-03-27 21:59:58 +00:00
parent b7904a89c9
commit 33d1217d6a
4 changed files with 34 additions and 0 deletions
+8
View File
@@ -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"