[racket] do loops in racket, also srfi/25 query

From: Joe Gilray (jgilray at gmail.com)
Date: Mon Mar 26 20:22:29 EDT 2012

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>

-Joe

On Mon, Mar 26, 2012 at 2:11 AM, Pierpaolo Bernardi <olopierpa at gmail.com>wrote:

> On Mon, Mar 26, 2012 at 01:31, Joe Gilray <jgilray at gmail.com> wrote:
> > Hi Tom,
> >
> > thanks for the comments.
> >
> > As far as reading the data into a vector, that can be accomplished with
> > "(define vec (read in))"  I was more interested in how to create an
> srfi/25
> > array from that vector.
>
> (apply array (shape 0 3 0 3) '(1 2 3 4 5 6 7 8 9))
> #<array:srfi-9-record-type-descriptor>
>
> Does this help?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120326/f3c3c0e8/attachment-0001.html>

Posted on the users mailing list.