My first guess would be to implement a multidim array as a single
array with the dimensions mapped onto that.
I have a question about what Shen can do regarding types related to this...
Can I include the size of an array or multidim array in the type? Then
declare something to be of type: [two-dim-array 4 5]. And then define
a matrix multiplication function something like this:
{(two-dim-array n m) --> (two-dim-array m p) --> (two-dim-array n p)}
Is something like this encoding the size of matrices in the type
system possible in Shen?
I'm a beginner in Shen, but I've been around the block a few times in
other languages. These are the things I need to learn in order to do
what I want with the language.
It is said: "Shen's type system is more powerful than that any
existing functional language including ML and Haskell." What about
type systems in things like Agda? Ah, this looks great:
http://sandycat.info/blog/deptypes-shen/
There's the answer to the question about matrix dims in the type right
there in that blog post. Awesome!
(and that's something about performance possibilities--with that type
of thing you don't need bounds checking on safevec accesses)
> Best advice is to learn macros and follow the course advised.
"course advised"? what course? Do you just mean reading all the Shen
documentation?
Thanks!
a wild card is essentially a placeholder, and is used where a value does
not matter.
In function parameters, the head of the list is obviously not important,
and is represented
by a wildcard on both sides of the ->. Exactly what this function does
I cannot tell you
without studying section 12.2 of the book.
Willi