chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] array-lib-hof - array-map! - not sure it's working


From: Terrence Brannon
Subject: Re: [Chicken-users] array-lib-hof - array-map! - not sure it's working
Date: Sun, 9 Sep 2007 21:09:01 -0400

On 9/9/07, Kon Lovett <address@hidden> wrote:
>
> On Sep 8, 2007, at 2:49 PM, Terrence Brannon wrote:
>
> > (require-extension array-lib)
> > (require-extension array-lib-hof)
> >
> > (define (quikary shape)
> >   (let ([element-count (apply * shape)])
> >     (apply array shape (iota element-count))))
> >
> > (define h (quikary '(2 3)))
>
> Quibble - 'shape' above isn't a "shape" but "dimensions"

Yes, I tend to fall into J terminology

>
> >
> > ; (array-map! h (lambda (z y x) "ho"))      doesnt throw an arity
> > error. doesnt change h
>
> The procedure is never called. You didn't provide any array(s) to
> map. The signature & semantics are per the SLIB procedure of the same
> name.

Ok, but my usual understanding of function documentation is that
anything in brackets is optional. And the signature here -
http://www.call-with-current-continuation.org/eggs/array-lib.html

is procedure: (array-map! ARRAY PROCEDURE [ARRAY ...])

and then note that the docs say:

Apply the procedure to each element of the array(s).

since the plural is parenthesized, that also means that anything
beyond one array is optional.


> > ; (array-index-map! h (lambda (y x) "ho"))  changes contents of h
>
> The procedure takes the indices, not the elements. Your array is rank
> 2, so your procedure has the correct number of parameters.

Yes, I will hijack array-index-map! even though I really didnt need
the indices for anything in particular.




reply via email to

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