Actually they are not right.

   1234 5678 3456 comp0 3456
1234
is the desired result, and

   1234 5678 3456 comp1 3456
5678
is the desired result.

Essentially I want to check if the second half of a split of x matches the 
first half of split y and vice versa.

e. and = seem inappropriate as e. would think that 3456 was desired and = would 
not think that 1234 and 5678 would be desired when they are.

I suppose a combination of |. and = could do it?

On 12 Nov 2011, at 00:37, David Vaughan wrote:

> Actually, G is not exactly what I want. The following two verbs are though:
> 
> comp0 =: {: @ e. & split # [
> comp1 =: {. @ e. & split # [
> 
>   1234 5678 comp0 3456
> 1234
>   1234 5678 comp1 3456
> 5678
> 
> I want to distinguish between the two matching cases.
> 
> On 11 Nov 2011, at 23:54, Raul Miller wrote:
> 
>> split looks like either 0 100&#: or 100&#.inv
>> 
>> g depends on f and you did not define f
>> 
>> Anyways, you might want:
>>  1234 5678 (+./"1@e.&(100&#.inv) # [) 3456
>> 1234 5678
>> 
>> Or:
>>  G=: +./"1@e.&(100&#.inv) # [
>>  1234 5678 G 3456
>> 
>> FYI,
>> 
>> -- 
>> Raul
>> 
>> 
>> On Fri, Nov 11, 2011 at 6:41 PM, David Vaughan
>> <[email protected]> wrote:
>>> I have a verb split:
>>> 
>>>  split =: <.@%&100 , 100&|
>>>  split 1234
>>> 12 34
>>> 
>>> I want to compare numbers to see if one of their 'split regions' (e.g. 12 
>>> or 34) matches a given number.
>>> So far I have:
>>> 
>>>  ]g =. 13 :'(f y) = (f"0 x)'
>>> ([: f ]) = [: f"0 [
>>>  1234 5678 g 3456
>>> 0 1
>>> 1 0
>>> 
>>> I want to make that actually return the numbers that matched, i.e.
>>> 
>>> 1234
>>> 5678
>>> 
>>> I can't seem to get a working solution for this.
>>> 
>>> Any help appreciated, thanks.
>>> ----------------------------------------------------------------------
>>> 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