This commit is contained in:
2023-02-07 18:32:59 +00:00
parent 0fc8183799
commit b8e3324acb
2 changed files with 10 additions and 3 deletions

View File

@@ -1,2 +1,9 @@
import compound; import compound;
fn f(acc, k, v) {
return acc + v;
}
var a = [1, 2, 3, 4];
print a.reduce(0, f); //prints "10"

View File

@@ -66,7 +66,7 @@ typedef struct Toy_Literal {
} identifier; } identifier;
struct { struct {
Toy_LiteralType typeOf; //no longer a mask Toy_LiteralType typeOf;
bool constant; bool constant;
void* subtypes; //for nested types caused by compounds void* subtypes; //for nested types caused by compounds
int capacity; int capacity;
@@ -75,7 +75,7 @@ typedef struct Toy_Literal {
struct { struct {
void* ptr; void* ptr;
int tag; //TODO: remove tags? int tag;
} opaque; } opaque;
} as; } as;
} Toy_Literal; } Toy_Literal;