[Jprogramming] Array Coordinates

Skip Cave skip at caveconsulting.com
Fri Nov 30 18:51:31 UTC 2018


Given the array a:
]a=.10 100ドル=23|i.100
1 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0
How can I write a function 'ac' that will list the coordinates of each 1 in
the array?
Example using array a:
ac a
0 0
2 3
4 6
6 9
9 3
Extend to 3 or more dimensions?
Skip Cave


More information about the Programming mailing list

AltStyle によって変換されたページ (->オリジナル) /