"Ultimately, I want to design a verb bix, that will take a list of
dimensions of any length, and generate boxed indices of the resulting
array."
bix 10
┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
│0│1│2│3│4│5│6│7│8│9│
└─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘
bix 3 4
┌───┬───┬───┬───┐
│0 0│0 1│0 2│0 3│
├───┼───┼───┼───┤
│1 0│1 1│1 2│1 3│
├───┼───┼───┼───┤
│2 0│2 1│2 2│2 3│
└───┴───┴───┴───┘
bix 2 3 4
┌─────┬─────┬─────┬─────┐
│0 0 0│0 0 1│0 0 2│0 0 3│
├─────┼─────┼─────┼─────┤
│0 1 0│0 1 1│0 1 2│0 1 3│
├─────┼─────┼─────┼─────┤
│0 2 0│0 2 1│0 2 2│0 2 3│
└─────┴─────┴─────┴─────┘
┌─────┬─────┬─────┬─────┐
│1 0 0│1 0 1│1 0 2│1 0 3│
├─────┼─────┼─────┼─────┤
│1 1 0│1 1 1│1 1 2│1 1 3│
├─────┼─────┼─────┼─────┤
│1 2 0│1 2 1│1 2 2│1 2 3│
└─────┴─────┴─────┴─────┘
/ ___| ___ | |_ _| |_(_) ___ _ __
\___ \ / _ \| | | | | __| |/ _ \| '_ \
___) | (_) | | |_| | |_| | (_) | | | |_ _ _
|____/ \___/|_|\__,_|\__|_|\___/|_| |_(_|_|_)
bix=. >L:1@:{::@:(<"0)@:i.
On Tue, Jan 10, 2017 at 6:05 PM, Skip Cave <[email protected]> wrote:
> Given a 3x4 matrix:
>
>
>
> a =. i. 3 4
>
> a
>
> 0 1 2 3
>
> 4 5 6 7
>
> 8 9 10 11
>
>
>
> I can get the horizontal indices:
>
>
>
> 4|a
>
> 0 1 2 3
>
> 0 1 2 3
>
> 0 1 2 3
>
>
>
>
>
> How do I get the vertical indices?
>
>
>
> 3?a NB. The question-mark represents the unknown verb
>
> 0 0 0 0
>
> 1 1 1 1
>
> 2 2 2 2
>
>
>
> Ultimately, I want to design a verb bix, that will take a list of
> dimensions of any length, and generate boxed indices of the resulting
> array. The number of integers in each box will be the same as the rank of
> the array:
>
>
>
>
> bix 10
>
> ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
>
> │0│1│2│3│4│5│6│7│8│9│
>
> └─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘
>
>
>
> bix 3 4
>
> ┌───┬───┬───┬───┐
>
> │0 0│0 1│0 2│0 3│
>
> ├───┼───┼───┼───┤
>
> │1 0│1 1│1 2│1 3│
>
> ├───┼───┼───┼───┤
>
> │2 0│2 1│2 2│2 3│
>
> └───┴───┴───┴───┘
>
>
> bix 2 3 4
>
> ┌─────┬─────┬─────┬─────┐
>
> │0 0 0│0 0 1│0 0 2│0 0 3│
>
> ├─────┼─────┼─────┼─────┤
>
> │0 1 0│0 1 1│0 1 2│0 1 3│
>
> ├─────┼─────┼─────┼─────┤
>
> │0 2 0│0 2 1│0 2 2│0 2 3│
>
> └─────┴─────┴─────┴─────┘
>
> ┌─────┬─────┬─────┬─────┐
>
> │1 0 0│1 0 1│1 0 2│1 0 3│
>
> ├─────┼─────┼─────┼─────┤
>
> │1 1 0│1 1 1│1 1 2│1 1 3│
>
> ├─────┼─────┼─────┼─────┤
>
> │1 2 0│1 2 1│1 2 2│1 2 3│
>
> └─────┴─────┴─────┴─────┘
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm