You might want to try something like:

   0 0 ssmb S:0 a
0 0 0 0 0
   0 0 ssmb S:0 b
0 0 1 0 0 0

Thanks,

-- 
Raul
On Fri, Oct 26, 2018 at 5:14 PM Skip Cave <[email protected]> wrote:
>
> Thanks Mike and R.E. Boss!
>
> The boolean version ssmb =. +./@E.   is what I needed.
>
> The non-boolean ssm=. +/@E.  is nice in that it indicates multiple
> occurrences of the string, though I don't really need it for what I was
> working on.
>
> ]a=. 1 2 3 4 ; 1 2 4 5 6; 1 3 2 5 4 1 ; 2 3 5 1 2 ; 1 2 3 1 2 3
>
> ┌───────┬─────────┬───────────┬─────────┬───────────┐
>
> │1 2 3 4│1 2 4 5 6│1 3 2 5 4 1│2 3 5 1 2│1 2 3 1 2 3│
>
> └───────┴─────────┴───────────┴─────────┴───────────┘
>
> 2 3 ssm"1 >a
>
> 1 0 0 1 2
>
> 2 3 ssmb"1 >a
>
> 1 0 0 1 1
>
> ]b=. 0 1 0 1 0;0 1 1;1 0 1 0 1 0 0 1 0 1 0 0 1;1 0 1 1 0 1 0;0 1 1 1 0;0 1
> 1 0 1 1
>
> ┌─────────┬─────┬─────────────────────────┬─────────────┬─────────┬───────────┐
>
> │0 1 0 1 0│0 1 1│1 0 1 0 1 0 0 1 0 1 0 0 1│1 0 1 1 0 1 0│0 1 1 1 0│0 1 1 0
> 1 1│
>
> └─────────┴─────┴─────────────────────────┴─────────────┴─────────┴───────────┘
>
>
> 1 1 ssm "1 >b
>
> 0 1 0 1 2 2
>
> 1 1 ssmb "1 >b
>
> 0 1 0 1 1 1
>
> However:
>
> 0 0 ssm "1 >a
>
> 1 0 0 0 0 NB. Wrong!
>
> 0 0 ssmb "1 >a
>
> 1 0 0 0 0 NB. Wrong!
>
> 0 0 ssm "1 >b
>
> 8 9 2 6 8 6 NB. Wrong!
>
> 0 0 ssmb "1 >b
>
> 1 1 1 1 1 1 NB. Wrong!
>
>
> All wrong! So detecting zeros is a problem with this scheme because of J's
> zero-fill rule..
>
>
> Skip
> ----------------------------------------------------------------------
> 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