Haskell: In the Repa library ... the lists are not Elts, but what about the "k-tuples",

I want to write an algorithm that intersects a 2-dimensional matrix of size k by n + 1 (say) and where each element in the array is a list of elements. These lists vary in size; they can be 1, 2, ..., k long. I can even say that in the first line they will all be length 1, in the second line: length 2, ..., in the k-th line: length k. I assume that Haskell has some kind of mechanism for k-tuples, I just don’t know what it is. Even if the type was indexed by some fixed size, that would be nice - it would mean a slight performance hit, but not so bad.

Any suggestions?

+4
source share
1 answer

If you have k rows of n columns, each of which contains k elements, can you use a list of rows of kxn matrices for the same thing?

In the repa head repository, they have a slightly different design where you can have elements that are not unboxed types - you can use lists (or vectors) there.

http://code.ouroborus.net/repa/

+1
source

Source: https://habr.com/ru/post/1401083/


All Articles