[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] (issue) array-lib - array-copy of rank-1 array with
Re: [Chicken-users] (issue) array-lib - array-copy of rank-1 array with complex elements
Tue, 18 Sep 2007 19:43:30 -0700
On Sep 18, 2007, at 6:47 PM, Terrence Brannon wrote:
(define (rank-1 . elems) (apply array (list (length elems)) elems))
(define a (rank-1 (make-rectangular 3 4) (make-rectangular 6 8)))
I assume you are also using the numbers egg.
;; procedure: (array-copy [PROTOTYPE] ARRAY)
;; Returns a copy of the array. When prototype is missing a deep
(array-copy a) ;;; Error: out of range
This is a bug; when the array is not an 'array-strict' it will fail.
;; When the prototype and the source array are the same,
;; (eq? PROTOTYPE ARRAY),
;; a fresh array is returned with the same shape, using the array
(array-copy a a) ;;; drops the 2nd element of the array. actually,
I'm thinking that it
;;; might be using the first element as a prototype for the rest of
the array. But the docs
;;; say it uses the array as prototype, not the first element of it.
Only the 1st, if any, element of a prototype is used for
initialization. That is why the prototype procedures accept 0 or 1
The behavior for '(array-copy <some array> <same array>)' isn't
intuitive but it is working as documented.
;; Otherwise a fresh array is returned with the specified
;; prototype and elements from the array.
(array-copy '#() a) ;;; works
It was supposed to give an copy of the array, with itself as
prototype, for '(array-copy #t arr)' but that wasn't documented, nor
correct. Fixed in 2.111
Chicken-users mailing list