That's not simple. -- Raul
On Sun, Nov 13, 2011 at 3:17 PM, Kip Murray <[email protected]> wrote: > Sorry, Simple J uses trains and rank but no other conjunction. > > On 11/13/2011 11:48 AM, Marc Simpson wrote: >> How about using adverse? >> >> k =: ( ([: +/ E.) ::0:> )"1 0 >> >> 'bc' k ::0: 'ab';'bc';'bcd';'ad';'a' >> 0 1 1 0 0 >> >> -M >> >> On Sat, Nov 12, 2011 at 6:31 PM, Kip Murray<[email protected]> wrote: >>> I didn't want to talk about it, but verb k depends on strings being >>> non-empty lists of characters, and the example you give can be fixed by >>> using the list ,'a' in place of the scalar 'a' : >>> >>> k =: ( ([: +/ E.)> )"1 0 >>> >>> 'bc' k 'ab';'bc';'bcd';'ad';'a' >>> |rank error: k >>> | 'bc' k'ab';'bc';'bcd';'ad';'a' >>> >>> 'bc' k 'ab';'bc';'bcd';'ad';,'a' >>> 0 1 1 0 0 >>> >>> $&.> 'ab';'bc';'bcd';'ad';'a' >>> +-+-+-+-++ >>> |2|2|3|2|| >>> +-+-+-+-++ >>> $&.> 'ab';'bc';'bcd';'ad';,'a' >>> +-+-+-+-+-+ >>> |2|2|3|2|1| >>> +-+-+-+-+-+ >>> $&.> ;:'ab bc bcd ad a' >>> +-+-+-+-+-+ >>> |2|2|3|2|1| >>> +-+-+-+-+-+ >>> >>> So using ;: is a good idea for not fussing with 'a' vs ,'a' . >>> >>> >>> On 11/12/2011 5:06 AM, Marc Simpson wrote: >>>> On Sat, Nov 12, 2011 at 2:13 AM, Kip Murray<[email protected]> wrote: >>> >>>> Good stuff—but note that the following case is problematic, >>>> >>>> 'bc' k 'ab';'bc';'bcd';'ad';'a' >>>> |rank error: k >>>> | 'bc' k'ab';'bc';'bcd';'ad';'a' >>>> >>>> In other words, padding with fill characters is a trade-off: on the >>>> one hand incorrect results are yielded for whitespace tests, on the >>>> other there are no length restrictions (length>= #x) placed on the >>>> boxed strings. >>>> >>>> When it's possible to use ;: as in Raul's example, the domain >>>> restriction and whitespace issues are resolved, >>>> >>>> 'bc' k ;:'ab bc bcd ad a' >>>> 0 1 1 0 0 >>>> ' ' k ;:'ab bc bcd ad a' >>>> 0 0 0 0 0 >>>> >>>> -M >>>> ---------------------------------------------------------------------- >>>> 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
