[gambit-list] Updated fork of SRFI 122, Nonempty Intervals and Generalized Arrays

Bradley Lucier lucier at math.purdue.edu
Tue Nov 27 15:25:26 EST 2018


On 11/16/18 2:25 PM, Bradley Lucier wrote:
> On 10/27/18 4:29 PM, Bradley Lucier wrote:
>> I maintain a fork of SRFI 122
>>
>> https://github.com/gambiteer/srfi-122/
>>
>> where I've added a few things that were not in the finalized SRFI, 
>> specifically the routines
>>
>> interval-cartesian-product
>> array-outer-product
>> array-assign!
> 
> I've added another update that implements and documents
> 
> array-tile

Another update, mainly for documentation:

Add a bulleted list of motivations.

Introduced the notational convention: If A is an array, then use A_ to 
denote the getter of the array and A! to denote the setter of A.

For example, the Haar transform loop now reads

(define (1D-Haar-loop a)
   (let ((a_ (array-getter a))
         (a! (array-setter a))
         (n (interval-upper-bound (array-domain a) 0)))
     (do ((i 0 (fx+ i 2)))
         ((fx= i n))
       (let* ((a_i               (a_ i))
              (a_i+1             (a_ (fx+ i 1)))
              (scaled-sum        (fl/ (fl+ a_i a_i+1) (flsqrt 2.0)))
              (scaled-difference (fl/ (fl- a_i a_i+1) (flsqrt 2.0))))
         (a! scaled-sum i)
         (a! scaled-difference (fx+ i 1))))))

The LU-decomposition example retrieves the i'th diagonal element of the 
matrix A with

(A_ i i)

The trailing underscore mimics the TeX notation for subscripts, and 
while underscores are used a lot in variable names in C, etc., they're 
not yet generally used in Scheme (at least as far as I know); I like it.

After cleaning up the implementation a bit, I'll be ready to submit a 
new SRFI for comments.

Brad



More information about the Gambit-list mailing list