OO: added inheritance, Collection, Iterator, Iterable, Array. Range is rewritten to be Iterable. Math namespace is temporarily broken (to be updated to new ObjClass model).

This commit is contained in:
sergeych committed 2025-06-01 17:48:24 +04:00
1 parent 698d169612
commit c65f711ee3
14 files changed
+444 -131

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
# Iterable interface
The inteface which requires iterator to be implemented:
fun iterator(): Iterator
Iterator itself is a simple interface that should provide only to method:
interface Iterable {
fun hasNext(): Bool
fun next(): Obj
}
Just remember at this stage typed declarations are not yet supported.
Having `Iterable` in base classes allows to use it in for loop. Also, each `Iterable` has some utility functions available:
## toList()
Creates a list by iterating to the end. So, the Iterator should be finite to be used with it.
## Included in interfaces:
- Collection, Array, [List]
## Implemented in classes:
- [List], [Range]
[List]: List.md
[Range]: Range.md