nest-shaped ( underlying shape -- array )


Vocabulary
arrays.shaped.private

Inputs
underlyingan object
shapean object


Outputs
arrayan object


Definition


:: nest-shaped ( underlying shape -- array )
shape length 1 <=
[ underlying >array ] [
shape rest :> tail tail product :> width shape first
<iota> [| i |
i width * dup width + underlying subseq
tail nest-shaped
] map
] if ;