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: Kon Lovett
Subject: Re: [Chicken-users] array-lib-hof - array-map! - not sure it's working
Date: Sun, 9 Sep 2007 09:05:32 -0700


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"


; (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.

#;9> (array-map! h (lambda (z y x) "ho") h)
Error: bad argument count - received 1 but expected 3: #<procedure (? z y x)>

        Call history:

        <syntax>                (array-map! h (lambda (z y x) "ho") h)
        <syntax>                (lambda (z y x) "ho")
        <syntax>                (begin "ho")
        <eval>          (array-map! h (lambda (z y x) "ho") h)  <--

; (array-map! h (lambda (z) "ho")) doesnt change contents of h
; (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.



_______________________________________________
Chicken-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/chicken-users





reply via email to

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