Email list hosting service & mailing list manager

relationship to SRFI-25 Per Bothner (30 Jul 2015 05:30 UTC)
Re: relationship to SRFI-25 John Cowan (30 Jul 2015 20:20 UTC)
Re: relationship to SRFI-25 Bradley Lucier (31 Jul 2015 21:00 UTC)
Re: relationship to SRFI-25 Bradley Lucier (26 Sep 2015 18:33 UTC)
Re: relationship to SRFI-25 Per Bothner (27 Sep 2015 05:34 UTC)
Re: relationship to SRFI-25 Bradley Lucier (28 Sep 2015 21:04 UTC)
Re: relationship to SRFI-25 Per Bothner (28 Sep 2015 21:29 UTC)
Re: relationship to SRFI-25 Bradley Lucier (28 Sep 2015 21:54 UTC)
Re: relationship to SRFI-25 Jamison Hope (28 Sep 2015 22:22 UTC)
Re: relationship to SRFI-25 Bradley Lucier (28 Sep 2015 22:38 UTC)
Re: relationship to SRFI-25 Jamison Hope (28 Sep 2015 23:20 UTC)
Re: relationship to SRFI-25 Bradley Lucier (29 Sep 2015 06:03 UTC)
Re: relationship to SRFI-25 Jamison Hope (29 Sep 2015 16:12 UTC)
Re: relationship to SRFI-25 Bradley Lucier (30 Sep 2015 03:42 UTC)

Re: relationship to SRFI-25 Bradley Lucier 31 Jul 2015 21:00 UTC

On 07/30/2015 01:30 AM, Per Bothner wrote:
> What is not discussed is how SRFI-122 differs from SRFI-25, and why?

SRFI-25 states:

=====================================================================
(make-array shape)
(make-array shape obj)
Returns a newly allocated array whose shape is given by shape. If obj is
provided, then each element is initialized to it. Otherwise the initial
contents of each element is unspecified. The array does not retain a
dependence to shape.
=====================================================================
and
=====================================================================
(array shape obj ...)
Returns a new array whose shape is given by shape and the initial
contents of the elements are obj ... in row major order. The array does
not retain a dependence to shape.
=====================================================================

In this SRFI, (array domain getter) allocates nothing except a few words
of memory for a structure that contains pointers to domain and getter.
There is no automatic allocation of arrays (or what this SRFI calls
array-body's), everything can be left as a function.

SRFI-25 states

=====================================================================
(array-set! array k ... obj)
(array-set! array index obj)
Stores obj in the element of array at index k .... Returns an
unspecified value. The sequence k ... must be a valid index to array. In
the second form, index must be either a vector or a 0-based
1-dimensional array containing k ....

    (let ((a (make-array
                (shape 4 5 4 5 4 5))))
       (array-set! a 4 4 4 'huuhkaja)
       (array-ref a 4 4 4))

Returns huuhkaja.
=====================================================================

In this SRFI, arrays don't have to be mutable.

>
> How is a SRFI-122 interval different from a SRFI-25 shape?

It isn't.

>
> Why can't SRFI-122 be a compatible superset of SRFI-25?

Hopefully I've explained above.

>
> Why would anyone want to write:
>   ((array-getter a) i j)
> instead of:
>   (array-ref a i j)

No one would.  This SRFI encourages a style of programming that's
different from the "store and move around one object at a time" style.

Brad