aboutsummaryrefslogtreecommitdiff
path: root/hmm.t
blob: 5c3d76ca3c9d75610f86d76c7f82ed5b0712fc5d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* common.ek */
typedef any {}

/* vec.ek */
typedef vec {
	i27  size;
	i27  cap;
	*any buf;
}

insert(*vec v, i27 i, typeof(*v.buf) e)
{
	...
}

/* define local vector type */
define vec!(t)
{
	struct vec [vec] {*t buf;}
}

/* map.ek */
typedef hashable {
	/* pointers? */
	i27 hash(hashable);
}

typedef map {
	i27 size;
	i27 cap;
	*hashable keys;
	*any values;
}

// vs. append(*map h, typeof h.keys[0] k, typeof h.values[0] e)
// vs. append(*map h, ?h.keys[0] k, ?h.values[0] e)
// vs. append(*map h, #h.keys[0] k, #h.values[0] e)
// vs. append(*map h, :h.keys[0] k, :h.values[0] e)
// vs something else, hmm
append(*map h, `h.keys[0] k, `h.values[0] e)
{
	...
}

/* main.ek */
main()
{
	vec!(i27) v;
	// should automatically find the correct insert (unless the same
	// elements as the vec typedef are used somewhere else)
	insert(v, 0, 20);
	// otherwise, force search as vec?
	insert(v as vec, 0, 20);
}