CD=: 4 : 'x -:&:(/:~)&:(10&#.^:_1) y'"0
   F=: +/&({. CD/ ])
   F0=: 1 2 3 4 5 6&*"0
   F F0 1
1
   F F0 1 2 3
1 1 1 1 1 1
1 1 1 0 0 0

On Thu, Sep 22, 2011 at 7:17 PM, David Vaughan
<[email protected]> wrote:
> Based on the first output I was expecting '1 1 1' for
> the second. I'm guessing I need to assign one or more
> of the verbs with a different rank, but I can't see what exactly to do.

   $F0 1
6
   $F0 1 2 3
3 6

   $({. CD/ ]) F0 1
6
   $({. CD/ ]) F0 1 2 3
6 3 6

The definition of CD does not really matter here -- it's rank 0.

The left argument for CD/ has the shape of an item of the result of F0

The right argument for CD/ has the shape the result of F0.

The shape of ({. CD/ ]) thus has the shape (}.@$,$)@F0

Now... looking back at your definitions:

CD compares two numbers and gives a 1 if they have the same digits in
their decimal representation

   CD=: -:&:(/:~)&:(10&#.inv)"0

And F looks like you are trying to say: how many of these numbers in
this sequence match the first one of the sequence.

Thus, I imagine you wanted:

   F=: +/&({. CD ])"1

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

Reply via email to