[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Psi Calculus



Sorry it's taken me so long to respond.  I've been
trying to read up on mathematics of arrays (mostly
unsuccessfully) so that I might have more intelligent
things to say.  In addition to SAC, the FISh langauge
is worth a look. 
http://www-staff.mcs.uts.edu.au/~cbj/FISh/index.html
and I need to take a better look at APL derivatives.

--- Jussi Piitulainen <jpiitula@xxxxxxxxxxxxxxxx>
wrote:
> It doesn't provide sharing as a primitive
> notion. I suppose it
> relies on a compiler to avoid a lot of unnecessary
> copying.

I believe so.  
 
> I think,
> 
> 1) modarray single element case in Scheme would _be_
> array-set!, not
>    make it redundant;

Not quite.  modarray is functional in SAC.  It returns
a new array.
 
> 2) reshape is partly provided by share-array and
> partly not provided
>    in current srfi-25; the row major stuff mentioned
> in Issues would
>    provide the latter part;

I think there needs to be something to get all the
data from the array.  Maybe 

  (flatten array) -> vector

Gets the data part of an array in row-major order.

> 4) there is no way around Scheme being an imperative
> language with
>    runtime typing; static compiler optimisations are
> not in reach, nor
>    is anything restricted to single assignment.

Hmmm...I don't want to start a bun-fight here. 
Optimisation is more difficult in Scheme because the
language hasn't been designed to make certain
properties obvious, but it is not impossible.  See,
e.g., http://library.readscheme.org/


A few more issues:

I think the basic procedures should all work on
vectors as arguments.  E.g. instead of

  (array-ref array x1 x2 ...)

I'd vouch for

   (array-ref array index-vector)

Why?  To preserve symmetry.  With functions returning
lists there is the nice symmetry that those results
can be immediately applied as the arguments to another
function.  No such symmetry exists with array-ref as
it currently stands.  You can't, e.g., get an array
slice representing an index and then apply that to
array-ref.  

I also think there is a need for a simple array slice
primitive (equivalent to the psi function in SAC). 
The provided function, though expressive, is complex
and makes writing simple array slices unduly
difficult.

cya,
Noel

__________________________________________________
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com