The following code works, and solves the following problem: identify
 the items in a boolean table that contain non-contiguous ones.

   negateHits=: * (-. + -)
   ix10idot  =: 1 i."1~ 1 0 E."1 ]
   ix01icolon=: (] negateHits (] = {:@[EMAIL PROTECTED])) (1 i:"1~ 0 1 E."1 ])
   b=: #: i. 2^3
   (ix01icolon > ix10idot) b
0 0 0 0 0 1 0 0
   
I'm very happy with negateHits, although it does have a data-control
 x-y parameter arrangement rather than the preferred control-data
 arrangement.

The two index-making definitions are closer than they look. The
 index-of-first-occurrences doesn't need to have the extra code because of the
 directionality of greater-than in the final line.

It seems to me that the next pass here, if this were to be refined,
 might be to create a conjunction that would take the bit pattern (1 0 or 0
 1) and the associated verb (i. or i:) then produce a verb. I don't
 think it is worth doing for this problem, but perhaps my skill is limiting
 my vision.

Also, if I missed a technique of solving this problem more simply than
 I have, I'd like to know. Thank you, in advance, for any comment!


Tracy



      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 

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

Reply via email to