feat: add Sequence.any method and update docs, tests, and core source
Implement the `any` method on the Sequence class that returns true if any element passes the given predicate function. Update the core.wren library source, the C embedded source string in wren_core.c, and add comprehensive test files for normal usage, non-bool return values, and non-function argument error handling. Also fix a typo in the QA documentation and correct the initial account balance in the example.
This commit is contained in:
@@ -68,6 +68,13 @@ static const char* libSource =
|
||||
" return true\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" any(f) {\n"
|
||||
" for (element in this) {\n"
|
||||
" if (f.call(element)) return true\n"
|
||||
" }\n"
|
||||
" return false\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" reduce(acc, f) {\n"
|
||||
" for (element in this) {\n"
|
||||
" acc = f.call(acc, element)\n"
|
||||
|
||||
Reference in New Issue
Block a user