val a = (0::m, 0::p){(i,j) => ((i + j * p) % 8).to[X] }
This syntax is known as a matrix constructor. It was borrowed from another DSL called OptiML. You can interpret this as a two dimensional for loop which declares the contents of a matrix. The 0::n says to iterate over 0 to n-1 inclusive. The i and j are iterators over that two dimensional space.
The fact that it returns a Matrix is directly a result of it being a 2d space being iterated over. Similar constructors exist for 1 - 5d collections.
implicit class IntOps(x: Int) {
def ::(y: Int): Series
}
implicit class Tuple2Ops(bounds: Tuple2[Series,Series]) {
def apply[T](func: (Int,Int) => T): Matrix[T]
}