I have implemented array coercions between array[array[T,N],M] -- array[T,N*M]
i.e. from an array of arrays to a matrix. however this is only one case, just rank 2 to rank 1 and back. In general, there is an isomorphism between any arrays of the same length, between 2 + 3 and 5 and between ((1,2),3) and (1,2,3) and (1,(2,3)) and so on. These generally isomorphic things are easy to write coercions for. The problem is I'm not sure its desirable. For example a 2 x 3 matrix is isomorphic to a 3 x 2 matrix, but you'd never want to do that coercion -- it would really jumble things up .. we're not talking about transposing the values here, but casting! But the problem is successive application of the 2 <--> 1 rank operation does NOT yield 3 <--> 1. The index would become (N * M) * P instead of N * M * P They're isomorphic .. but not equal. But i can't write out all the possible coercions, and i'm not even sure how to limit them to "what's desirable" because I'm not actually sure what that is! -- john skaller skal...@users.sourceforge.net http://felix-lang.org ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language