[racket] Typed Racket reactions on developing polymorphic typed array library, and questions

From: Noel Welsh (noelwelsh at gmail.com)
Date: Tue Aug 24 01:39:44 EDT 2010

On Mon, Aug 23, 2010 at 11:12 PM, Neil Toronto <neil.toronto at gmail.com> wrote:
> It works similarly, but it's not the same. Those use the sequence
> abstraction; this uses a multidimensional random-access abstraction called
> "arrayn". Also, "forall" and "foralln" semantics are meant to be concurrent,
> so in principle they can always parallelize the work. Further, arrays are
> read/write when their backing models are read/write (e.g. vectors).

This is great stuff. If you're not familiar with Single Assignment C
take a look at it. It's the only modern functional language I know
that takes arrays seriously. It has an interesting array comprehension

> At first I tried to use the sequence abstraction. But Sequenceof is a
> polymorphic type, so I couldn't get require/typed to import in-vector et al.
> I don't want to use sequences now, though. Arrays should be read/write.
> Destructive update can be useful in interactive programs like games.
> Avoiding allocation reduces GC collects, which reduces stutters and hitches.

The example you gave is something that could be written with
for/vector. One could equally implement for/vector! that mutates an
existing vector. It is really when you move to higher dimensions that
for/* variants have problems, as the order you construct the matrix
becomes difficult to express.


Posted on the users mailing list.