Joe, hope this helps to clarify… Bill was suggesting this…/Rob arr=:10 $ > ;: 'ab cd yyy jcd' arr ab cd yyy jcd ab cd yyy jcd ab cd 'cd' E."1 arr 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 +./"1 'cd' E."1 arr 0 1 0 1 0 1 0 1 0 1
On 28 Aug 2014, at 10:12 pm, Joe Bogner <joebog...@gmail.com> wrote: > Tracy - symbols are a good way to go. Thanks for reminding me of them. > > Raul - that's what I was missing... I needed to use e. with the same > shape: eg. arr e. (1 3 $ 'ab ')... Thank you. Your examples are nice > and generic and faster than -:"1 > > ... > bill - Not sure what to do with E. > > Bjorn - 'ab' I. arr doesn't seem to help either... I was hoping for a > mask of 0 1 0 1 for whether it was found or the indices > > On Thu, Aug 28, 2014 at 7:56 AM, Björn Helgason <gos...@gmail.com> wrote: >> 'ab' I. arr >> >> __-------------------_ >> https://groups.google.com/forum/m/#!forum/havaogskulamal >> On 28 Aug 2014 10:58, "Joe Bogner" <joebog...@gmail.com> wrote: >> >>> Apologies for the extremely basic question, but I am struggling with >>> this after searching NuVoc and the dictionary. >>> >>> How do I locate all the indices of 'ab' in arr? >>> >>> arr=:10 $ > ;: 'ab cd yyy' >>> >>> surely this isn't the best way: >>> >>> ] (3 = +/"1 'ab' i. arr) # arr >>> ab >>> ab >>> ab >>> ab >>> >>> >>> I have been primarily dealing with boxed strings up to this point, >>> which seemed easier since it was locating an atom in a list, not a >>> list in a table (practicing my vocabulary here... I might be wrong >>> though) >>> >>> >>> Thanks, >>> Joe >>> ---------------------------------------------------------------------- >>> 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