2018-8: Making a Good Argument
Part of Dyalog's help text for dyadic transpose R←X⍉Y
states:
- Y
may be any array.
- X
must be a simple scalar or vector whose elements are included in the set ⍳⍴⍴Y
.
- Integer values in X
may be repeated but all integers in the set ⍳⌈/X
must be included.
- The length of X
must equal the rank of Y
.
Write an APL function that given a right argument Y
of any array and a numeric scalar or vector left argument X
returns a Boolean indicating if the left argument is a valid argument for X⍉Y
, like the result of {0::0 ⋄ 1⊣⍺⍉⍵}
but does not use ⍉
(to test the arguments).
Examples:
3 1 2 (your_function) 2 3 4⍴⍳24
1
2 1 2 (your_function) 2 3 4⍴⍳24
1
2 3 2 (your_function) 2 3 4⍴⍳24
0
1 1 (your_function) 3 4⍴⍳12
1
1 2 (your_function) 2 3 4⍴⍳24
0
1.1 2 3 (your_function) 2 3 4⍴⍳24
0
1 (your_function) ⍬
1
⍬ (your_function) 1
1
your_function ←
Solutions

