My intent was to strip the non essential zeros . the original boolean vector based on the inside expression +./"1 'cd' E."1 arr and multiplied by i.#arr gave 0 1 0 3 0 5 0 7 0 9 for which the indices of interest are 0(first one)1 3 5 7 To be able to account for the first index being 0 , I added 1 and decremented the result. KEY (/. ) does strip unwanted zeros but gives 2 rows- but the desired row depends on the first item of the boolean list.

What I would like to see is the equivalent of the APL boolean slash.
e.g.

1 1 0 0 1/⍳5 ( ⍳ being iota)
1 2 5

Don Kelly

On 28/08/2014 4:23 PM, Henry Rich wrote:
Remember that x +./@:E. y, x i.&1@:E. y, etc use Boyer-Moore, so potentially much faster.

Henry Rich

On 8/28/2014 5:52 PM, Don Kelly wrote:
to complete it

<: ((+./"1 'cd' E."1 arr)*>:i.# arr)-.0

1 3 5 7 9

<: ((+./"1 'ab' E."1 arr)*>:i.# arr)-.0

0 4 8


1 5 9 0 4 8{arr

cd

cd

cd

ab

ab

ab
now make it tacit.


Don Kelly


On 28/08/2014 5:44 AM, Rob Hodgkinson wrote:
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


----------------------------------------------------------------------
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