It seems my AtDot from long ago is doing the trick.
AtDot=: 2 : (':';'[ v^:_1 u@v')
0 0 1 0 0 1 >:@] AtDot # i.6
0 0 3 0 0 6
/Erling
On 2017-01-01 21:40, David Koppenhoefer wrote:
Reading the wonderful NuVoc I found the gem that dyadic # has an inverse
- it can therefore be used in &. like
>: &. (0 0 1 0 0 1&#) i.6
0 0 3 0 0 6
, executing a function only on selected items of an array while keeping
the shape.
The bit array is a noun, but I want to compute it on the fly (from the
right argument). If the v in u&.v had dyadic valence, something like
0 0 1 0 0 1 >:@] &. # i.6
would be possible and the left argument could be replaced by a
computation. Here I'm stuck. From what I understood so far this seems to
be impossible - the v in the &-conjunctions is always monadic. Is
there a way to save the idea?
P.S.: needed in AoC day 24...
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm