> Hi J'ers,
> 
> I'm trying to write a verb that will
> match the items in Source with Target
> and return the index of items in Target
> such that they are in the same order as
> Source with nulls (or the J way of handling nulls)
> if no match is found.
> 
> This is what i have (and it's wrong):
> 
> Source =. 'a';'bcd';'e';'g'
> Target =. 'e';'a';'bcd';'f'
> getIndex =: e.
> shouldReturn =. 1 2 0 null
> assert (Source getIndex Target)=shouldReturn
> 
Hi Joe,

i. may be what you are looking for:

   Source =. 'a';'bcd';'e';'g'
   Target =. 'e';'a';'bcd';'f'
   Target i. Source
1 2 0 4

null is here represented with 4, which in general equals #Target, so

   Target =. 'e';'a';'bcd'
   Target i. Source
1 2 0 3



> In the forums I've found solution candidates,but
> haven't been able to apply them and am a bit lost with:
> I.@:E. and ;:
> 
> The concept of expressing null or missing data in J I haven't
> found much info on. Where can i find more information on nulls.
> 
> Much Thanks -Joe
-- 
View this message in context: 
http://old.nabble.com/Re%3A--Jprogramming--index-of-matched-items-tp33732128s24193p33732128.html
Sent from the J Programming mailing list archive at Nabble.com.

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to