2012/12/8 Danny Yoo <d...@hashcollision.org>: >> Or maybe using a : or something to separate rows for 2D arrays? >> (array 1 2 : 3 4)
The matrix library uses arrays to represent the matrices. An 2x3 matrix can be constructed as: (matrix/dim 2 3 1 2 3 4 5 6) (list->matrix '[[1 2 3] [4 5 6]]) (for/matrix: : Number 2 3 ([i (in-naturals)]) i) These expressions will all return the same 2D array. Given that the shape of a matrix is fixed, the problems with square parentheses in constructor notation disappear. That is, one could let matrix be a macro, and it could accept both kinds of parentheses: (matrix [[1 2 3] [4 5 6]]) (matrix ((1 2 3) (4 5 6))) See more matrix examples here: https://github.com/plt/racket/blob/master/collects/math/tests/matrix-tests.rkt -- Jens Axel Søgaard ____________________ Racket Users list: http://lists.racket-lang.org/users