Seems like it works in a column-oriented (not sure if the wording is
correct here :-) way:

$ echo ${.sh.version}
Version JMP 93u+ 2012-02-29
$ typeset -a arr=( ( 1 2 3 ) ( 4 5 6 ) ( 7 8 9 ) ( 10 11 12 ) )
$ typeset -n ref=arr[0]
$ echo ${!ref[@]}
0 1 2 3
$ echo ${ref[@]}
1 4 7 10
$ ref[0]=change
$ typeset -p arr
typeset -a arr=((change 2 3) (4 5 6) (7 8 9) (10 11 12) )
$

On Thu, Mar 22, 2012 at 14:36, Clark J. Wang <[email protected]> wrote:

> For example:
>
> $ echo $KSH_VERSION
> Version JMP 93u+ 2012-02-29
> $ typeset -a arr=( ( 1 2 ) ( 3 4 5 ) )
> $ typeset -n ref=arr[1]    <== no errors reported so I assume this is
> supported
> $ typeset -p ref
> typeset -n ref=arr    <== ???
> $ echo ${ref[0][@]}    <== but actually `ref' is not the reference to
> `arr' either
>
> $ echo ${ref[1][@]}
>
> $ echo ${ref[@]}
> 1 3
> $ echo ${!ref[@]}
> 0 1
> $
>
> With multi-dimension arrays it's very natural to define a function to
> operate on the array row by row as one often does in other languages like C.
>
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to