Hi Joe, On Mon, Mar 26, 2012 at 21:22, Joe Gilray <jgil...@gmail.com> wrote:
> Hi Pierpaolo, > > Yes, I could read the data into a list and then create an array from it: > > (array-ref (apply array (shape 0 3 0 3) '(1 2 3 4 5 6 7 8 9)) 2 2) > 9 > > But, I don't seem to be able to do the same from a vector: > > (array-ref (apply array (shape 0 3 0 3) #(1 2 3 4 5 6 7 8 9)) 2 1) > apply: expects type <proper list> as 3rd argument, given: '#(1 2 3 4 5 6 > 7 8 9); other arguments were: #<procedure:array> > #<array:srfi-9-record-type-descriptor> > > > It's late night here and I didn't look at the docs, but from the error message it seems that you cannot pass a vector to the array constructor. With a vector at hand, we can use vector->list to do the appropriate conversion: (array-ref (apply array (shape 0 3 0 3) (vector->list #(1 2 3 4 5 6 7 8 9))) 2 1) On racket.exe: Welcome to Racket v5.2.1. > (require srfi/25) > (array-ref (apply array (shape 0 3 0 3) (vector->list #(1 2 3 4 5 6 7 8 9))) 2 1) 8 []'s Rodolfo
____________________ Racket Users list: http://lists.racket-lang.org/users