I'm in the throws of trying to get multi-dimensional arrays working. The theory behind this was developed by Barry Jay.
Basically, there's map: (T ^ N) ^ M -> T ^ (N * M) taking an array of arrays to a matrix. Example on values: ( (1,2), (3,4), (5,6) ) . 1 . 1 --> 4 (zero origin remember) The second: ( 1, 2, 3, 4, 5, 6 ) . (1,1) --> 4 The underlying representation of both is the same: a linear array of 6 integers. The index calculation is the same in both cases too: 1 * 2 + 1 = 3 However, the two data structures are utterly different: the data functor here is ARRAY. The core rule for maps is: MAP f (ARRAY T) --> ARRAY ( f T) i.e. the map of f over an array is an array of f of each T. For the array of arrays this means f applies to the inner array. For the matrix, it means f applies to all the elements. In other words: MAP f (matrix) = MAP (MAP f) (ARRAY . ARRAY) The importance here is that an operator representing the "reshaping" isomorphism determines where the map maps its function argument. -- 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