arrays

Started by Sammo, February 08, 2004, 06:18:23 AM

Previous topic - Next topic

Sammo

A couple of array questions:



1)  Is 'length' supposed to work directly on arrays? It seems to work but other list-related functions (e.g., 'first') understandably don't. The 'length' entry in manual version 7.5.2 refers to lists and strings but not arrays.



(set 'a (array 5 5))

(length (array-list a)) => 5

(length a) => 5



2)  Is there or could there be a way to determine an array's structure -- something like:(define (array-dims a , dims)
    (while (array? a)
        (push (length (array-list a)) dims)
        (setq a (nth 0 a)) )
    (reverse dims) )
For example:



(set 'a (array 2 3 '(("magoo"))) )

(array-dims a) => (2 3)