feat: add Sequence.all method and forall documentation with tests
Implement `all(f)` method on Sequence class that returns true if all elements pass the predicate function. Add corresponding documentation entry for `forall(predicate)` in core-library.markdown. Include three test files covering basic functionality, non-boolean return handling, and non-function argument error cases.
This commit is contained in:
@@ -14,6 +14,13 @@ class Sequence {
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
all(f) {
|
||||
for (element in this) {
|
||||
if (!f.call(element)) return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
class List is Sequence {
|
||||
|
||||
Reference in New Issue
Block a user