I'm thinking of something along the lines of # (copy)

1 1 1 0 1 0 0 1 0 1 # i.10

0 1 2 4 7 9


Only "apply" uses a boolean left argument to define which elements on the
right are affected by the verb:


1 1 1 0 1 0 0 1 0 1 (apply -.) 1 1 1 1 1 1 1 1 1 1

0 0 0 1 0 1 1 0 1 0

1 1 1 0 1 0 0 1 0 1 (apply 2&+) 1 1 1 1 1 1 1 1 1 1

3 3 3 1 3 1 1 3 1 3

1 1 1 0 1 0 0 1 0 1 (apply 2&^~) i.10

0 1 4 3 16 5 6 49 8 81

Is this possible?

Skip Cave
Cave Consulting LLC


On Thu, Jan 16, 2020 at 2:08 AM Arnab Chakraborty <damd...@gmail.com> wrote:

> My first idea was to use ^: . But I am unable to get a solution. None of
> the posted solutions use ^: either. Just wondering whether ^: can help
> here.
>
> On Thu, 16 Jan 2020, 12:36 'robert therriault' via Programming, <
> programm...@jsoftware.com> wrote:
>
> > It is too late, considering the result is not the one that you requested!
> >
> > Anyway I would use a numerical approach something like the incorrect one
> > that I just posted.
> >
> > Sheepishly - Cheers, bob
> >
> > > On Jan 15, 2020, at 23:03, 'robert therriault' via Programming <
> > programm...@jsoftware.com> wrote:
> > >
> > > Hi Skip,
> > >
> > > A late snowy night silly approach
> > >
> > >    ]a=.20#1
> > > 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
> > >   f1=. *@(3&|)@:i.@:#  NB. mod 3 non-zeros
> > >   f1 a
> > > 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1
> > >   f2=. -.@*@(2&|)@:i.@:#  NB. mod 2 zeros
> > >   f2 a
> > > 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
> > >   (f1 *: f2) a  NB. Not-And fork
> > > 1 1 0 1 0 1 1 1 0 1 0 1 1 1 0 1 0 1 1 1
> > >   f=. f1 *: f2  NB. requested result
> > >   f a
> > > 1 1 0 1 0 1 1 1 0 1 0 1 1 1 0 1 0 1 1 1
> > >
> > > Cheers, bob
> > >
> > >
> > >> On Jan 15, 2020, at 22:29, Skip Cave <s...@caveconsulting.com> wrote:
> > >>
> > >> ]a=.20#1
> > >
> > > ----------------------------------------------------------------------
> > > 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

Reply via email to