Tons of stuff. Regex still a work in progress, along with related template member function scoping bugs

This commit is contained in:
Nathan Braswell
2015-06-09 20:02:02 -04:00
parent 47bc52f00c
commit d90cb4b6db
14 changed files with 78 additions and 28 deletions

View File

@@ -2,6 +2,12 @@ import mem:*;
import util:*;
import io:*;
fun vector<T>(in:T):vector<T> {
var out.construct():vector<T>
out.add(in)
return out
}
obj vector<T> (Object) {
var data: T*;
var size: int;
@@ -125,6 +131,13 @@ obj vector<T> (Object) {
}
return newVec
}
fun filter(func: fun(T):bool):vector<T> {
var newVec.construct(): vector<T>
for (var i = 0; i < size; i++;)
if (func(data[i]))
newVec.addEnd(data[i])
return newVec
}
fun any_true(func: fun(T):bool):bool {
for (var i = 0; i < size; i++;)
if (func(data[i]))