guile-user
[Top][All Lists]
Advanced

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

Re: name an array function


From: Daniel Llorens
Subject: Re: name an array function
Date: Wed, 23 Nov 2016 17:07:30 +0100

On 21 Nov 2016, at 14:56, address@hidden wrote:

> I (politely) disagree: the most "commonly" used function is
> already array-ref, so you would seldomly use array-from/slice
> for a scalar result (the rank-0 result will be more frequent,
> because there's no substitute). But hey, as I said.

I don't use array-ref/set! anymore since array-from/amend! generalize them. I 
actually use a further generalization in a separate library :p

But I have a proposal below that makes this discussion moot, I hope.

| master (current)    | meaning                          | proposal             
|
|---------------------+----------------------------------+----------------------|
| array-from*         | look up subarray, even #0(x)     | array-slice          
|
| array-from          | look up cell, so x and not #0(x) | array-cell-ref       
|
| array-amend!        | set cell                         | array-cell-set!      
|
| array-for-each-cell | iterate over subarrays           | array-for-each-slice 
|

We define a k-cell to be a (prefix) k-subarray except that the 0-cells are x 
instead of #0(x). This is also consistent with the APL/J terminology (there are 
no rank 0 arrays in APL/J that are different from a simple element).

(array-for-each-cell) however must iterate over k-subarrays (not k-cells) so 
that they can be used as write targets. Then it makes sense to change this name 
to (array-for-each-slice), and all the names are consistent.

What do you think?

Regards

        lloda




reply via email to

[Prev in Thread] Current Thread [Next in Thread]