Matrix
matrix type is an interesting type.
we want to add two matrix
0 0 1 2 1 2
+ =
2 1 4 3 6 4
But if a 2 3 matrix add a 3 4 matrix? It should be error.
But how to do that?
In elz, operator is a special function.
So let's define Matrix's add
fn +(lv: Matrix, rv: Matrix) -> Matrix { ... }
It can not solve the problem we meet.
We want to limit the x & y of Matrix.
fn +<x: int, y: int>(lv: Matrix<x, y>, rv: Matrix<x, y>) -> Matrix<x, y> { ... }
If this can work, then problem already done. Thanks Idris, it inspired me about this.
So generic should became template. I will try it.