40 lines
636 B
Plaintext
40 lines
636 B
Plaintext
fn main(args: [String])
|
|
println(args[0])
|
|
end
|
|
|
|
int Index<T, I>
|
|
op [](i: I) -> T
|
|
end
|
|
|
|
int Slice<T> : Index<T, ISize>, Iterable<T>
|
|
length: ISize
|
|
|
|
def fn iter() -> Iterator<T>
|
|
let mut i = 0
|
|
{
|
|
if i < length then
|
|
i++
|
|
Some(self[i - 1])
|
|
else
|
|
None
|
|
end
|
|
}
|
|
end
|
|
end
|
|
|
|
int Iterator<T>
|
|
fn next() -> Option<T>
|
|
end
|
|
|
|
int Iterable<T>
|
|
fn iter() -> Iterator<T>
|
|
end
|
|
|
|
extern class Array<T> : Index<T, ISize>, Slice<T>
|
|
extern length: ISize
|
|
extern op [](i: ISize) -> T
|
|
end
|
|
|
|
int List<T> : Index<T, ISize>, Slice<T>
|
|
|
|
end |