Saturday, July 21, 2012

Grid dimensions

The dimensions of a grid are mutable, but the area of the grid is not. As such, in my computer algebra system the dimensions relation is implemented as a place:
(setf [dimensions [[1 2 3] [4 5 6]]] [3 2])
The transpose operation on matrices can be implemented as an automorphism that rearranges the elements of the collection and that reverses the dimensions of the grid.
(zap reverse [dimensions coll])
Any permutation operation, including reverse, can be applied to the dimensions place without every producing an error because permutations do not change the area part of the underlying grid structure.

No comments:

Post a Comment