feat: add Set class example and List.contains method to core library

Add a complete Set class implementation in example/set.wren with union, intersection, and set minus operations. Implement List.contains method in builtin/core.wren and its C source to support element existence checks via iteration.
This commit is contained in:
Bob Nystrom
2015-01-12 03:50:07 +00:00
3 changed files with 128 additions and 0 deletions
+9
View File
@@ -84,6 +84,15 @@ static const char* libSource =
" }\n"
" return result\n"
" }\n"
"\n"
" contains(element) {\n"
" for (item in this) {\n"
" if (element == item) {\n"
" return true\n"
" }\n"
" }\n"
" return false\n"
" }\n"
"}\n"
"\n"
"class Range is Sequence {}\n";