You might also be interested in the inverse of copy

1 0 0 0 1 0 1 #^:_1 'abc'

a b c


I remember I had a hard time finding expand

On Fri, Apr 16, 2021 at 1:53 AM ethiejiesa via Programming <
[email protected]> wrote:

> Is monadic # what you're looking for?
>
>        mask # chars
>     BEG
>
> HH PackRat <[email protected]> wrote:
> > Hello, all!
> >
> > I have a list of characters and a boolean list of 1s and 0s.  I
> > thought that I could use the boolean list as a "mask" to choose
> > characters by using "and" (*.).  But the definition in NuVoc basically
> > states that it can only be used with numbers (no literals).
> >
> > Here's an example of the kind of thing I'd like to be able to do:
> >
> > chars=. 'ABCDEFGHIJKLM'
> > mask=. 0 1 0 0 1 0 1 0 0 0 0 0 0   [boolean values]
> >
> > mask2=. 0 1 0 0 4 0 6 0 0 0 0 0 0   [positions of boolean values]
> >
> > I thought that I could do something like  chars *. mask to get the
> > result BEG.  That doesn't work nor does converting the mask to
> > position numbers (mask2) work.  So how *can* I mask the characters?
> > I'd be interested in knowing both the "pure" boolean kind of approach
> > (1s and 0s only) as well as a positional approach that I can use with
> > amending.
> >
> > My ultimate goal is actually to amend the masked characters to be a
> > different character(s).  I hope I've given enough information.  (The
> > example, of course, is completely "fake", but I hope it gives the idea
> > of what I'm trying to do.)
> >
> > Thanks for any help!
> >
> > Harvey
> > ----------------------------------------------------------------------
> > 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