Hello, still I am puzzling with the definition of multidimensional
arrays. I guess they should be parameterized by a) their element type
and b) their dimension. I tried to define such a type analogously to
the last two posts in the following thread:
http://comments.gmane.org/gmane.lisp.qi/2420
(datatype array
X:(vector A);
=============
X:(array A 1);
X:(array A (+ 1 N));
=====================
X:(vector (array A N));
)
(define nested-array
{(list number) --> (array A K)}
[N] -> (vector N)
[N | Ns] -> (let New-Vector (vector N)
(nest-array-set-elems New-Vector 1 N Ns)
)
)
(define nest-array-set-elems
{(vector B) -->
number -->
number -->
(list number) -->
(vector (array A L))}
Vector Limit Limit Ns ->
(vector-> Vector Limit (nested-array Ns))
Vector Index Limit Ns ->
(let New-Vec (vector-> Vector Index (nested-array Ns))
(nest-array-set-elems New-Vec (+ Index 1) Limit Ns)
)
)
(Boiled this down to the essential.) Compiling this I get the error
message
"type error in rule 1 of nested array".
Could anybody give me a hint?
Best regards
Johannes