[Jprogramming] Array Coordinates

Skip Cave skip at caveconsulting.com
Fri Nov 30 19:59:19 UTC 2018


Raul,
I had been trying all kinds of stuff with I., but raveling the array along
with antibase to split the digits was what i needed.
Skip
On Fri, Nov 30, 2018 at 1:31 PM Raul Miller <rauldmiller at gmail.com> wrote:
> Or, slightly longer:
> ($a)#:I.,a
> or
> ($#:I.@,)a
>> ...
>> Thanks,
>> --
> Raul
>> On Fri, Nov 30, 2018 at 2:04 PM Don Guinn <donguinn at gmail.com> wrote:
> >
> > Or do
> >
> > 4 $.$.a
> >
> > On Fri, Nov 30, 2018, 11:56 AM Roger Hui <rogerhui.canada at gmail.com
> wrote:
> >
> > > a #&, {i.&.>$a
> > > ┌───┬───┬───┬───┬───┐
> > > │0 0│2 3│4 6│6 9│9 2│
> > > └───┴───┴───┴───┴───┘
> > > > a #&, {i.&.>$a
> > > 0 0
> > > 2 3
> > > 4 6
> > > 6 9
> > > 9 2
> > >
> > >
> > >
> > > On Fri, Nov 30, 2018 at 10:52 AM Skip Cave <skip at caveconsulting.com>
> > > wrote:
> > >
> > > > 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
> > > >
> ----------------------------------------------------------------------
> > > > For information about J forums see
> http://www.jsoftware.com/forums.htm
> > > ----------------------------------------------------------------------
> > > For information about J forums see http://www.jsoftware.com/forums.htm
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm


More information about the Programming mailing list

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